Commit 33af421d7b646721b80c54e25fcdd1df9497ccb3

Alex Szpakowski 2016-02-14T21:17:25

Windows: make sure SDL_TicksInit has been called before calling Sleep(ms) in SDL_Delay. This ensures the Windows system timer resolution is properly set before Sleep is called.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/src/timer/windows/SDL_systimer.c b/src/timer/windows/SDL_systimer.c
index abfbcb9..d2d30c8 100644
--- a/src/timer/windows/SDL_systimer.c
+++ b/src/timer/windows/SDL_systimer.c
@@ -189,6 +189,10 @@ SDL_Delay(Uint32 ms)
     }
     WaitForSingleObjectEx(mutex, ms, FALSE);
 #else
+    if (!ticks_started) {
+        SDL_TicksInit();
+    }
+
     Sleep(ms);
 #endif
 }