From: Vsevolod Stakhov Date: Tue, 16 Oct 2018 11:28:13 +0000 (+0100) Subject: [Minor] Try to use a faster timer if available X-Git-Tag: 1.8.1~8 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=09db5880e68d6cb38e4db03f43c3f744646f5411;p=thirdparty%2Frspamd.git [Minor] Try to use a faster timer if available --- diff --git a/src/libutil/util.c b/src/libutil/util.c index b177661444..20b884cf99 100644 --- a/src/libutil/util.c +++ b/src/libutil/util.c @@ -1794,6 +1794,16 @@ restart: #endif } +#ifdef HAVE_CLOCK_GETTIME +# ifdef CLOCK_MONOTONIC_COARSE +# define RSPAMD_FAST_MONOTONIC_CLOCK CLOCK_MONOTONIC_COARSE +# elif defined(CLOCK_MONOTONIC_FAST) +# define RSPAMD_FAST_MONOTONIC_CLOCK CLOCK_MONOTONIC_FAST +# else +# define RSPAMD_FAST_MONOTONIC_CLOCK CLOCK_MONOTONIC +# endif +#endif + gdouble rspamd_get_ticks (gboolean rdtsc_ok) { @@ -1814,7 +1824,7 @@ rspamd_get_ticks (gboolean rdtsc_ok) #endif #ifdef HAVE_CLOCK_GETTIME struct timespec ts; - gint clk_id = CLOCK_MONOTONIC; + gint clk_id = RSPAMD_FAST_MONOTONIC_CLOCK; clock_gettime (clk_id, &ts);