[Scummvm-git-logs] scummvm master -> 421e36a3a8220107004955f316045dfeeb181e2e

ccawley2011 ccawley2011 at gmail.com
Sun Nov 15 22:42:17 UTC 2020


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
421e36a3a8 NULL: Implement getMillis() and delayMillis() on Windows


Commit: 421e36a3a8220107004955f316045dfeeb181e2e
    https://github.com/scummvm/scummvm/commit/421e36a3a8220107004955f316045dfeeb181e2e
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2020-11-15T22:42:01Z

Commit Message:
NULL: Implement getMillis() and delayMillis() on Windows

Changed paths:
    backends/platform/null/null.cpp


diff --git a/backends/platform/null/null.cpp b/backends/platform/null/null.cpp
index 4e69d933c4..a89bbea205 100644
--- a/backends/platform/null/null.cpp
+++ b/backends/platform/null/null.cpp
@@ -25,6 +25,10 @@
 #include <sys/time.h>
 #include <unistd.h>
 #include <signal.h>
+#elif defined(WIN32)
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+#undef main
 #endif
 
 // We use some stdio.h functionality here thus we need to allow some
@@ -88,6 +92,8 @@ public:
 private:
 #ifdef POSIX
 	timeval _startTime;
+#elif defined(WIN32)
+	DWORD _startTime;
 #endif
 };
 
@@ -124,6 +130,8 @@ void intHandler(int dummy) {
 void OSystem_NULL::initBackend() {
 #ifdef POSIX
 	gettimeofday(&_startTime, 0);
+#elif defined(WIN32)
+	_startTime = GetTickCount();
 #endif
 #if defined(POSIX) && !defined(NULL_DRIVER_USE_FOR_TEST)
 	last_handler = signal(SIGINT, intHandler);
@@ -174,6 +182,8 @@ uint32 OSystem_NULL::getMillis(bool skipRecord) {
 
 	return (uint32)(((curTime.tv_sec - _startTime.tv_sec) * 1000) +
 			((curTime.tv_usec - _startTime.tv_usec) / 1000));
+#elif defined(WIN32)
+	return GetTickCount() - _startTime;
 #else
 	return 0;
 #endif
@@ -182,6 +192,8 @@ uint32 OSystem_NULL::getMillis(bool skipRecord) {
 void OSystem_NULL::delayMillis(uint msecs) {
 #ifdef POSIX
 	usleep(msecs * 1000);
+#elif defined(WIN32)
+	Sleep(msecs);
 #endif
 }
 




More information about the Scummvm-git-logs mailing list