diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fb69e8e..b10ba459 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,6 +57,17 @@ check_library_exists(m pow "" HAVE_LIBM) check_include_file("dirent.h" HAVE_DIRENT_H) check_symbol_exists(strcasecmp "strings.h" HAVE_DECL_STRCASECMP) check_symbol_exists(strncasecmp "strings.h" HAVE_DECL_STRNCASECMP) +check_c_source_compiles(" + #include + int main() + { + CreateWaitableTimerEx(NULL, NULL, CREATE_WAITABLE_TIMER_HIGH_RESOLUTION, + TIMER_ALL_ACCESS); + return 0; + } + " + HAVE_HIGH_RES_TIMER +) check_c_source_compiles(" #include int main() diff --git a/config.h.in b/config.h.in index 088899f3..26e6b2db 100644 --- a/config.h.in +++ b/config.h.in @@ -6,6 +6,7 @@ #cmakedefine HAVE_DIRENT_H #cmakedefine01 HAVE_DECL_STRCASECMP #cmakedefine01 HAVE_DECL_STRNCASECMP +#cmakedefine HAVE_HIGH_RES_TIMER #cmakedefine HAVE__DIV64 #cmakedefine HAVE_ALSA #cmakedefine HAVE_FLUIDSYNTH diff --git a/src/i_timer.c b/src/i_timer.c index ed6101cd..723e96c3 100644 --- a/src/i_timer.c +++ b/src/i_timer.c @@ -148,11 +148,13 @@ void I_InitTimer(void) #ifdef _WIN32 // Create an unnamed waitable timer. + hTimer = NULL; + #ifdef HAVE_HIGH_RES_TIMER hTimer = CreateWaitableTimerEx(NULL, NULL, CREATE_WAITABLE_TIMER_MANUAL_RESET | CREATE_WAITABLE_TIMER_HIGH_RESOLUTION, TIMER_ALL_ACCESS); - + #endif if (hTimer == NULL) { hTimer = CreateWaitableTimer(NULL, TRUE, NULL);