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 100675be0ebfaad70
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
     1.1 --- a/src/timer/windows/SDL_systimer.c	Sat Feb 13 17:35:38 2016 +0100
     1.2 +++ b/src/timer/windows/SDL_systimer.c	Sun Feb 14 21:17:25 2016 -0400
     1.3 @@ -189,6 +189,10 @@
     1.4      }
     1.5      WaitForSingleObjectEx(mutex, ms, FALSE);
     1.6  #else
     1.7 +    if (!ticks_started) {
     1.8 +        SDL_TicksInit();
     1.9 +    }
    1.10 +
    1.11      Sleep(ms);
    1.12  #endif
    1.13  }