If precise_time is false, we should not set EVENT_BASE_FLAG_PRECISE_TIMER

Fixes: 630f077c296de61c7b99ed83bf30de11e75e2740 ("Simple unit tests for
monotonic timers")
This commit is contained in:
yongqing.jiao 2017-12-09 14:39:07 +08:00 committed by Azat Khuzhin
parent bc65ffc14c
commit 6cce7458d0

View File

@ -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);