]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Try to use a faster timer if available
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 16 Oct 2018 11:28:13 +0000 (12:28 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 16 Oct 2018 11:28:13 +0000 (12:28 +0100)
src/libutil/util.c

index b1776614448bcc65682d188a5e65f25b09998883..20b884cf99499aaa6892141a055a0c956ae6d42d 100644 (file)
@@ -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);