From 500738e0cf01b79b3c226b9f781099697d5261d7 Mon Sep 17 00:00:00 2001 From: Christopher Wellons Date: Sun, 3 Feb 2019 15:45:31 -0500 Subject: [PATCH] Use vDSO for the clock on Linux --- endlessh.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/endlessh.c b/endlessh.c index 43c517a..f947fa7 100644 --- a/endlessh.c +++ b/endlessh.c @@ -29,7 +29,11 @@ static long long uepoch(void) { struct timespec tv; +#ifdef __linux__ + clock_gettime(CLOCK_REALTIME_COARSE, &tv); +#else clock_gettime(CLOCK_REALTIME, &tv); +#endif return tv.tv_sec * 1000ULL + tv.tv_nsec / 1000000ULL; }