43 gettimeofday(&tv, NULL);
44 return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
45 #elif HAVE_GETSYSTEMTIMEASFILETIME
48 GetSystemTimeAsFileTime(&ft);
49 t = (int64_t)ft.dwHighDateTime << 32 | ft.dwLowDateTime;
50 return t / 10 - 11644473600000000;
58 #if HAVE_CLOCK_GETTIME && defined(CLOCK_MONOTONIC)
60 clock_gettime(CLOCK_MONOTONIC, &ts);
61 return (int64_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
69 #if HAVE_CLOCK_GETTIME && defined(CLOCK_MONOTONIC)
79 struct timespec ts = { usec / 1000000, usec % 1000000 * 1000 };
80 while (nanosleep(&ts, &ts) < 0 && errno == EINTR);