diff options
| author | 2020-02-13 08:19:12 +0000 | |
|---|---|---|
| committer | 2020-02-13 08:19:12 +0000 | |
| commit | 1712ccf14f9b771f1b54029276403e38052716be (patch) | |
| tree | 2f89941ac389ea580660ef8acfc21e5e7c0a58a7 /usr.bin/dig/lib/isc/unix/stdtime.c | |
| parent | remove ISC_HEAP_CHECK knob, it was never turned (diff) | |
| download | wireguard-openbsd-1712ccf14f9b771f1b54029276403e38052716be.tar.xz wireguard-openbsd-1712ccf14f9b771f1b54029276403e38052716be.zip | |
trust gettimeofday doing the right thing
Diffstat (limited to 'usr.bin/dig/lib/isc/unix/stdtime.c')
| -rw-r--r-- | usr.bin/dig/lib/isc/unix/stdtime.c | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/usr.bin/dig/lib/isc/unix/stdtime.c b/usr.bin/dig/lib/isc/unix/stdtime.c index b2a172f87a6..2f9d94c50f6 100644 --- a/usr.bin/dig/lib/isc/unix/stdtime.c +++ b/usr.bin/dig/lib/isc/unix/stdtime.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: stdtime.c,v 1.2 2020/02/11 23:26:12 jsg Exp $ */ +/* $Id: stdtime.c,v 1.3 2020/02/13 08:19:12 florian Exp $ */ /*! \file */ @@ -28,38 +28,6 @@ #include <isc/stdtime.h> #include <isc/util.h> -#ifndef ISC_FIX_TV_USEC -#define ISC_FIX_TV_USEC 1 -#endif - -#define US_PER_S 1000000 - -#if ISC_FIX_TV_USEC -static inline void -fix_tv_usec(struct timeval *tv) { - isc_boolean_t fixed = ISC_FALSE; - - if (tv->tv_usec < 0) { - fixed = ISC_TRUE; - do { - tv->tv_sec -= 1; - tv->tv_usec += US_PER_S; - } while (tv->tv_usec < 0); - } else if (tv->tv_usec >= US_PER_S) { - fixed = ISC_TRUE; - do { - tv->tv_sec += 1; - tv->tv_usec -= US_PER_S; - } while (tv->tv_usec >=US_PER_S); - } - /* - * Call syslog directly as we are called from the logging functions. - */ - if (fixed) - (void)syslog(LOG_ERR, "gettimeofday returned bad tv_usec: corrected"); -} -#endif - void isc_stdtime_get(isc_stdtime_t *t) { struct timeval tv; @@ -73,12 +41,5 @@ isc_stdtime_get(isc_stdtime_t *t) { RUNTIME_CHECK(gettimeofday(&tv, NULL) != -1); -#if ISC_FIX_TV_USEC - fix_tv_usec(&tv); - INSIST(tv.tv_usec >= 0); -#else - INSIST(tv.tv_usec >= 0 && tv.tv_usec < US_PER_S); -#endif - *t = (unsigned int)tv.tv_sec; } |
