summaryrefslogtreecommitdiffstats
path: root/usr.bin/dig/lib/isc/log.c
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2020-02-16 21:11:02 +0000
committerflorian <florian@openbsd.org>2020-02-16 21:11:02 +0000
commita12dcefb48e200107d0d2d0ced8c8d9c25cb6d86 (patch)
tree9fb057b930c99b994191b88919f80cc550e5796c /usr.bin/dig/lib/isc/log.c
parentMove isc_time_formathttptimestamp to the only place it is used. (diff)
downloadwireguard-openbsd-a12dcefb48e200107d0d2d0ced8c8d9c25cb6d86.tar.xz
wireguard-openbsd-a12dcefb48e200107d0d2d0ced8c8d9c25cb6d86.zip
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
Diffstat (limited to 'usr.bin/dig/lib/isc/log.c')
-rw-r--r--usr.bin/dig/lib/isc/log.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.bin/dig/lib/isc/log.c b/usr.bin/dig/lib/isc/log.c
index 0d47ea2bf22..76a01473640 100644
--- a/usr.bin/dig/lib/isc/log.c
+++ b/usr.bin/dig/lib/isc/log.c
@@ -14,7 +14,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: log.c,v 1.12 2020/02/16 21:09:32 florian Exp $ */
+/* $Id: log.c,v 1.13 2020/02/16 21:11:02 florian Exp $ */
/*! \file
* \author Principal Authors: DCL */
@@ -945,7 +945,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
time_string[0] == '\0') {
struct timespec now;
- TIME_NOW(&now);
+ clock_gettime(CLOCK_REALTIME, &now);
strftime(time_string, sizeof(time_string),
"%d-%b-%Y %X", localtime(&now.tv_sec));
}
@@ -987,7 +987,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
* which fall within the duplicate_interval
* range.
*/
- TIME_NOW(&oldest);
+ clock_gettime(CLOCK_REALTIME, &oldest);
timespecsub(&oldest, &interval, &oldest);
message = ISC_LIST_HEAD(lctx->messages);
@@ -1050,7 +1050,7 @@ isc_log_doit(isc_log_t *lctx, isc_logcategory_t *category,
strlcpy(message->text, lctx->buffer,
size);
- TIME_NOW(&message->time);
+ clock_gettime(CLOCK_REALTIME, &message->time);
ISC_LINK_INIT(message, link);
ISC_LIST_APPEND(lctx->messages,