From c1c191717f5ef2a32ab668c4f82dbe4d89616314 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Tue, 4 Oct 2016 15:38:16 +0200 Subject: Use CLOCK_MONOTONIC_RAW for timers if available Should make timers work more precisely on Linux. --- liberty.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/liberty.c b/liberty.c index c3051d8..1c71ab1 100644 --- a/liberty.c +++ b/liberty.c @@ -83,7 +83,10 @@ extern char **environ; -#ifdef _POSIX_MONOTONIC_CLOCK +#ifdef CLOCK_MONOTONIC_RAW +// This should be more accurate for shorter intervals +#define CLOCK_BEST CLOCK_MONOTONIC_RAW +#elif defined _POSIX_MONOTONIC_CLOCK #define CLOCK_BEST CLOCK_MONOTONIC #else // ! _POSIX_MONOTIC_CLOCK #define CLOCK_BEST CLOCK_REALTIME -- cgit v1.2.3-70-g09d2