diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-04-06 18:45:33 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-04-06 18:45:33 +0100 |
commit | 1b3208fd723c0de8239386d1f60ca088e9f8a29f (patch) | |
tree | 6b0f13d57ec13a3de7f36b7aeddeca3a6473719a | |
parent | 96246143f738d35178160de25bf233dbfe688fa5 (diff) | |
download | rspamd-1b3208fd723c0de8239386d1f60ca088e9f8a29f.tar.gz rspamd-1b3208fd723c0de8239386d1f60ca088e9f8a29f.zip |
[Fetaure] Use less precise clock if possible
-rw-r--r-- | src/libutil/util.c | 10 |
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__) |