Fix time_update() to compile and work on MinGW.
This commit is contained in:
parent
56139dc403
commit
fd9cd7a6cc
15
src/time.c
15
src/time.c
@ -161,12 +161,15 @@ time_update(struct timespec *time)
|
|||||||
time_copy(&old_time, time);
|
time_copy(&old_time, time);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
FILETIME ft;
|
{
|
||||||
uint64_t ticks;
|
FILETIME ft;
|
||||||
GetSystemTimeAsFileTime(&ft);
|
uint64_t ticks;
|
||||||
ticks = (ft.dwHighDateTime << 32) | ft.dWLowDateTime;
|
GetSystemTimeAsFileTime(&ft);
|
||||||
time->tv_sec = ticks / 10000;
|
ticks = (((uint64_t)ft.dwHighDateTime) << 32) |
|
||||||
time->tv_nsec = ((ticks % 10000) * 100);
|
ft.dwLowDateTime;
|
||||||
|
time->tv_sec = ticks / 10000000;
|
||||||
|
time->tv_nsec = ((ticks % 10000000) * 100);
|
||||||
|
}
|
||||||
#elif JEMALLOC_CLOCK_GETTIME
|
#elif JEMALLOC_CLOCK_GETTIME
|
||||||
if (sysconf(_SC_MONOTONIC_CLOCK) > 0)
|
if (sysconf(_SC_MONOTONIC_CLOCK) > 0)
|
||||||
clock_gettime(CLOCK_MONOTONIC, time);
|
clock_gettime(CLOCK_MONOTONIC, time);
|
||||||
|
Loading…
Reference in New Issue
Block a user