From 46e28f8d2a3862ae429d59bb4b12a13c751691a2 Mon Sep 17 00:00:00 2001 From: "Rob Swindell (on Windows 11)" <rob@synchro.net> Date: Tue, 4 Feb 2025 16:43:24 -0800 Subject: [PATCH] When building for Windows Vista+, use GetTickCount64() through-out At one point while migrating off the Windows XP compatible WinSDK and toolset, I was getting nice deprecation warnings in this file about uses of GetTickCount() and the 49 day roll-over isuse. I stopped getting those deprecation warnings (not sure when/why), but I'm still doing the right thing here/now and using the newer Win32 API function when it's available (always, for the versions of Windows we're building Synchronet and friends for). --- src/xpdev/genwrap.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/xpdev/genwrap.c b/src/xpdev/genwrap.c index 30f6a3f70a..c77c5c9f7b 100644 --- a/src/xpdev/genwrap.c +++ b/src/xpdev/genwrap.c @@ -39,6 +39,11 @@ #elif defined(_WIN32) #include <windows.h> #include <lm.h> /* NetWkstaGetInfo() */ + #if WINVER >= 0x0600 // _WIN32_WINNT_VISTA + #define GetTickCount() GetTickCount64() + #endif +#else + #endif #include "genwrap.h" /* Verify prototypes */ @@ -1052,7 +1057,7 @@ long double xp_timer(void) #endif } else { - ret = GetTickCount(); + ret = (long double)GetTickCount(); ret /= 1000; } #else @@ -1160,11 +1165,7 @@ int64_t xp_fast_timer64(void) else ret = -1; #elif defined(_WIN32) -#if WINVER < 0x0600 ret = GetTickCount() / 1000; -#else - ret = GetTickCount64() / 1000; -#endif #else #error no high-resolution time for this platform #endif -- GitLab