use GetTickCount()/GetTickCount64() under windows
GetTickCount() when GetTickCount64() is not available
This commit is contained in:
parent
af1ea9f60b
commit
2db013d891
|
@ -453,7 +453,16 @@ parseMSEARCHReply(const char * reply, int size,
|
||||||
|
|
||||||
static int upnp_gettimeofday(struct timeval * tv)
|
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;
|
struct timespec ts;
|
||||||
int ret_code = clock_gettime(UPNP_CLOCKID, &ts);
|
int ret_code = clock_gettime(UPNP_CLOCKID, &ts);
|
||||||
if (ret_code == 0)
|
if (ret_code == 0)
|
||||||
|
|
Loading…
Reference in New Issue