]> source.dussan.org Git - rspamd.git/commitdiff
[Fetaure] Use less precise clock if possible
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 6 Apr 2016 17:45:33 +0000 (18:45 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 6 Apr 2016 17:45:33 +0000 (18:45 +0100)
src/libutil/util.c

index 0ea4f4df90fb344d5b04fd17e5a2e4fe85c812ee..7a649508e96c39c41d401d277341f0a63ea20bb4 100644 (file)
@@ -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__)