Windows: use GetTickCount64() for a monotonic timer that does not wrap

pull/774/head
Brad House 9 months ago
parent f70f09f01c
commit 1dff8f6576
  1. 6
      src/lib/ares__timeval.c

@ -32,11 +32,9 @@
ares_timeval_t ares__tvnow(void)
{
/* GetTickCount() is available on _all_ Windows versions from W95 up
* to nowadays. Returns milliseconds elapsed since last system boot,
* increases monotonically and wraps once 49.7 days have elapsed. */
/* GetTickCount64() is available on Windows Vista and higher */
ares_timeval_t now;
DWORD milliseconds = GetTickCount();
ULONGLONG milliseconds = GetTickCount64();
now.sec = (ares_int64_t)milliseconds / 1000;
now.usec = (unsigned int)(milliseconds % 1000) * 1000;

Loading…
Cancel
Save