diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-10-16 12:28:13 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-10-16 12:28:13 +0100 |
commit | 09db5880e68d6cb38e4db03f43c3f744646f5411 (patch) | |
tree | 55d24c2226301f4c4de9e0e663d5dab52914cc87 /src/libutil/util.c | |
parent | e75992bf3340fdf3e9c9a9787ab19d1e1dd37cc3 (diff) | |
download | rspamd-09db5880e68d6cb38e4db03f43c3f744646f5411.tar.gz rspamd-09db5880e68d6cb38e4db03f43c3f744646f5411.zip |
[Minor] Try to use a faster timer if available
Diffstat (limited to 'src/libutil/util.c')
-rw-r--r-- | src/libutil/util.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libutil/util.c b/src/libutil/util.c index b17766144..20b884cf9 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); |