Use vDSO for the clock on Linux

This commit is contained in:
Christopher Wellons
2019-02-03 15:45:31 -05:00
parent 7ac1fbff3b
commit 500738e0cf

View File

@@ -29,7 +29,11 @@ static long long
uepoch(void) uepoch(void)
{ {
struct timespec tv; struct timespec tv;
#ifdef __linux__
clock_gettime(CLOCK_REALTIME_COARSE, &tv);
#else
clock_gettime(CLOCK_REALTIME, &tv); clock_gettime(CLOCK_REALTIME, &tv);
#endif
return tv.tv_sec * 1000ULL + tv.tv_nsec / 1000000ULL; return tv.tv_sec * 1000ULL + tv.tv_nsec / 1000000ULL;
} }