summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-06 18:45:33 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-04-06 18:45:33 +0100
commit1b3208fd723c0de8239386d1f60ca088e9f8a29f (patch)
tree6b0f13d57ec13a3de7f36b7aeddeca3a6473719a
parent96246143f738d35178160de25bf233dbfe688fa5 (diff)
downloadrspamd-1b3208fd723c0de8239386d1f60ca088e9f8a29f.tar.gz
rspamd-1b3208fd723c0de8239386d1f60ca088e9f8a29f.zip
[Fetaure] Use less precise clock if possible
-rw-r--r--src/libutil/util.c10
1 files changed, 9 insertions, 1 deletions
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__)