use GetTickCount()/GetTickCount64() under windows

GetTickCount() when GetTickCount64() is not available
This commit is contained in:
Thomas Bernard 2020-09-23 00:59:41 +02:00
parent af1ea9f60b
commit 2db013d891
No known key found for this signature in database
GPG Key ID: DB511043A31ACAAF
1 changed files with 10 additions and 1 deletions

View File

@ -453,7 +453,16 @@ parseMSEARCHReply(const char * reply, int size,
static int upnp_gettimeofday(struct timeval * tv)
{
#if defined(CLOCK_MONOTONIC_FAST) || defined(CLOCK_MONOTONIC)
#if defined(_WIN32)
#if (_WIN32_WINNT >= _WIN32_WINNT_VISTA)
ULONGLONG ts = GetTickCount64();
#else
DWORD ts = GetTickCount();
#endif
tv->tv_sec = ts / 1000;
tv->tv_usec = (ts % 1000) * 1000;
return 0; /* success */
#elif defined(CLOCK_MONOTONIC_FAST) || defined(CLOCK_MONOTONIC)
struct timespec ts;
int ret_code = clock_gettime(UPNP_CLOCKID, &ts);
if (ret_code == 0)