From a12dcefb48e200107d0d2d0ced8c8d9c25cb6d86 Mon Sep 17 00:00:00 2001 From: florian Date: Sun, 16 Feb 2020 21:11:02 +0000 Subject: clock_gettime cannot fail if called correctly; unravel TIME_NOW indirections. (I'm not convinced that we always want to read CLOCK_REALTIME, in fact we probably want to almost always read CLOCK_MONOTONIC.) OK millert --- usr.bin/dig/lib/isc/timer.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'usr.bin/dig/lib/isc/timer.c') diff --git a/usr.bin/dig/lib/isc/timer.c b/usr.bin/dig/lib/isc/timer.c index 8c4bf3a04d4..20e472b99f9 100644 --- a/usr.bin/dig/lib/isc/timer.c +++ b/usr.bin/dig/lib/isc/timer.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: timer.c,v 1.17 2020/02/16 21:08:59 florian Exp $ */ +/* $Id: timer.c,v 1.18 2020/02/16 21:11:02 florian Exp $ */ /*! \file */ @@ -218,7 +218,7 @@ isc__timer_create(isc_timermgr_t *manager0, const struct timespec *interval, /* * Get current time. */ - TIME_NOW(&now); + clock_gettime(CLOCK_REALTIME, &now); timer = malloc(sizeof(*timer)); if (timer == NULL) @@ -291,7 +291,7 @@ isc__timer_reset(isc_timer_t *timer0, const struct timespec *interval, /* * Get current time. */ - TIME_NOW(&now); + clock_gettime(CLOCK_REALTIME, &now); if (purge) (void)isc_task_purgerange(timer->task, @@ -322,7 +322,7 @@ isc__timer_touch(isc_timer_t *timer0) { REQUIRE(VALID_TIMER(timer)); - TIME_NOW(&now); + clock_gettime(CLOCK_REALTIME, &now); timespecadd(&now, &timer->interval, &timer->idle); } @@ -565,7 +565,7 @@ isc__timermgr_dispatch(isc_timermgr_t *manager0) { manager = timermgr; if (manager == NULL) return; - TIME_NOW(&now); + clock_gettime(CLOCK_REALTIME, &now); dispatch(manager, &now); } -- cgit v1.2.3-59-g8ed1b