From 1b3208fd723c0de8239386d1f60ca088e9f8a29f Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 6 Apr 2016 18:45:33 +0100 Subject: [PATCH] [Fetaure] Use less precise clock if possible --- src/libutil/util.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/libutil/util.c b/src/libutil/util.c index 0ea4f4df9..7a649508e 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -1790,7 +1790,15 @@ rspamd_get_ticks (void) #ifdef HAVE_CLOCK_GETTIME struct timespec ts; - clock_gettime (CLOCK_MONOTONIC, &ts); + gint clk_id = CLOCK_MONOTONIC; + +#ifdef CLOCK_MONOTONIC_FAST + clk_id = CLOCK_MONOTONIC_FAST; +#endif +#ifdef CLOCK_MONOTONIC_COARSE + clk_id = CLOCK_MONOTONIC_COARSE; +#endif + clock_gettime (clk_id, &ts); res = (double)ts.tv_sec + ts.tv_nsec / 1000000000.; #elif defined(__APPLE__) -- 2.39.5