Commit 94a58261 authored by Bob Halley's avatar Bob Halley
Browse files

do not get the current time for an inactive timer

parent c6ed7136
......@@ -246,14 +246,24 @@ isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type,
/*
* Get current time.
*/
result = isc_time_now(&now);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_time_now() failed: %s",
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
if (type != isc_timertype_inactive) {
result = isc_time_now(&now);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_time_now() failed: %s",
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
}
} else {
/*
* We don't have to do this, but it keeps the compiler from
* complaining about "now" possibly being used without being
* set, even though it will never actually happen.
*/
isc_time_settoepoch(&now);
}
mctx = isc_task_mem(task);
timer = isc_mem_get(mctx, sizeof *timer);
if (timer == NULL)
......@@ -340,12 +350,21 @@ isc_timer_reset(isc_timer_t *timer, isc_timertype_t type,
/*
* Get current time.
*/
result = isc_time_now(&now);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_time_now() failed: %s",
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
if (type != isc_timertype_inactive) {
result = isc_time_now(&now);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"isc_time_now() failed: %s",
isc_result_totext(result));
return (ISC_R_UNEXPECTED);
}
} else {
/*
* We don't have to do this, but it keeps the compiler from
* complaining about "now" possibly being used without being
* set, even though it will never actually happen.
*/
isc_time_settoepoch(&now);
}
manager = timer->manager;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment