]> granicus.if.org Git - libevent/commitdiff
If precise_time is false, we should not set EVENT_BASE_FLAG_PRECISE_TIMER
authoryongqing.jiao <yongqing.jiao@datayes.com>
Sat, 9 Dec 2017 06:39:07 +0000 (14:39 +0800)
committerAzat Khuzhin <a3at.mail@gmail.com>
Sun, 10 Dec 2017 21:10:23 +0000 (00:10 +0300)
Fixes: 630f077c296de61c7b99ed83bf30de11e75e2740 ("Simple unit tests for
monotonic timers")

event.c

diff --git a/event.c b/event.c
index 98b1bc4ab6733ef21562b93ad1de89a50e9c3ef3..3e24d3d42f8a9b615f6badf2e2666d36a5604eba 100644 (file)
--- a/event.c
+++ b/event.c
@@ -591,7 +591,9 @@ event_base_new_with_config(const struct event_config *cfg)
                int flags;
                if (should_check_environment && !precise_time) {
                        precise_time = evutil_getenv_("EVENT_PRECISE_TIMER") != NULL;
-                       base->flags |= EVENT_BASE_FLAG_PRECISE_TIMER;
+                       if (precise_time) {
+                               base->flags |= EVENT_BASE_FLAG_PRECISE_TIMER;
+                       }
                }
                flags = precise_time ? EV_MONOT_PRECISE : 0;
                evutil_configure_monotonic_time_(&base->monotonic_timer, flags);