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.
authorAlex Szpakowski <slime73@gmail.com>
Sun, 14 Feb 2016 21:17:25 -0400
changeset 10067 5be0ebfaad70
parent 10066 15b261fad7b9
child 10068 19998f9082dc
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.
src/timer/windows/SDL_systimer.c
--- a/src/timer/windows/SDL_systimer.c	Sat Feb 13 17:35:38 2016 +0100
+++ b/src/timer/windows/SDL_systimer.c	Sun Feb 14 21:17:25 2016 -0400
@@ -189,6 +189,10 @@
     }
     WaitForSingleObjectEx(mutex, ms, FALSE);
 #else
+    if (!ticks_started) {
+        SDL_TicksInit();
+    }
+
     Sleep(ms);
 #endif
 }