QueryPerformanceCounter() is reliable these days, and setting the timer frequency higher can have adverse power consequences.
authorSam Lantinga <slouken@libsdl.org>
Thu, 02 May 2013 16:54:03 -0700
changeset 713665c709a5da8a
parent 7135 20db445af8c7
child 7137 e4daf38f9bde
QueryPerformanceCounter() is reliable these days, and setting the timer frequency higher can have adverse power consequences.
http://msdn.microsoft.com/en-us/library/windows/desktop/dd757624%28v=vs.85%29.aspx
src/timer/windows/SDL_systimer.c
     1.1 --- a/src/timer/windows/SDL_systimer.c	Thu May 02 23:12:03 2013 +0200
     1.2 +++ b/src/timer/windows/SDL_systimer.c	Thu May 02 16:54:03 2013 -0700
     1.3 @@ -48,13 +48,13 @@
     1.4  #ifdef USE_GETTICKCOUNT
     1.5      start = GetTickCount();
     1.6  #else
     1.7 -#if 0                           /* Apparently there are problems with QPC on Win2K */
     1.8 +    /* QueryPerformanceCounter has had problems in the past, but lots of games 
     1.9 +       use it, so we'll rely on it here.
    1.10 +     */
    1.11      if (QueryPerformanceFrequency(&hires_ticks_per_second) == TRUE) {
    1.12          hires_timer_available = TRUE;
    1.13          QueryPerformanceCounter(&hires_start_ticks);
    1.14 -    } else
    1.15 -#endif
    1.16 -    {
    1.17 +    } else {
    1.18          hires_timer_available = FALSE;
    1.19          timeBeginPeriod(1);     /* use 1 ms timer precision */
    1.20          start = timeGetTime();