diff options
| author | 2025-05-25 18:35:12 -0400 | |
|---|---|---|
| committer | 2025-05-25 18:35:12 -0400 | |
| commit | 9fb3646511998310fc8c967c239803f38b2bdc5b (patch) | |
| tree | 92f1bbc2c7cacfcf0c24b49f88ba220cdeebbde9 /src/util/timer | |
| parent | ef86574ec5d859727695da65f683f0774a3b4460 (diff) | |
| download | libnaunet-9fb3646511998310fc8c967c239803f38b2bdc5b.tar.gz libnaunet-9fb3646511998310fc8c967c239803f38b2bdc5b.tar.bz2 libnaunet-9fb3646511998310fc8c967c239803f38b2bdc5b.zip | |
Windows XP support
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/util/timer')
| -rw-r--r-- | src/util/timer/timer_windows.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/util/timer/timer_windows.c b/src/util/timer/timer_windows.c index f26e56a..4ff95ff 100644 --- a/src/util/timer/timer_windows.c +++ b/src/util/timer/timer_windows.c @@ -14,8 +14,17 @@ static const s64 UNIX_TIME_START = 0x019DB1DED53E8000; // January 1st, 1970 in " u64 nn_get_timestamp(void) { - FILETIME ft; - GetSystemTimePreciseAsFileTime(&ft); - return (((LARGE_INTEGER){ .LowPart = ft.dwLowDateTime, .HighPart = ft.dwHighDateTime }).QuadPart - - UNIX_TIME_START) / 10Lu; + FILETIME ft; +#ifdef NAUNET_WIN32_COMPAT_MODE + GetSystemTimeAsFileTime(&ft); +#else + // https://github.com/llvm/llvm-project/commit/3ec634e65a02d5f443cc982e9e00ec4e51143d07 +#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8 && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)) || \ + (_WIN32_WINNT >= _WIN32_WINNT_WIN10) + GetSystemTimePreciseAsFileTime(&ft); +#else +#error "GetSystemTimePreciseAsFileTime() requested but not supported." +#endif +#endif + return (((LARGE_INTEGER){ .LowPart = ft.dwLowDateTime, .HighPart = ft.dwHighDateTime }).QuadPart - UNIX_TIME_START) / 10u; } |