diff options
author | 2004-12-06 20:57:17 +0000 | |
---|---|---|
committer | 2004-12-06 20:57:17 +0000 | |
commit | 96d66300e3819a93aa87a09b52544d69a6bc326a (patch) | |
tree | 68b7cae92b8f284ee1a8aa42674ff79dd2c99299 | |
parent | make signal blocking a lot easier. (diff) | |
download | wireguard-openbsd-96d66300e3819a93aa87a09b52544d69a6bc326a.tar.xz wireguard-openbsd-96d66300e3819a93aa87a09b52544d69a6bc326a.zip |
do not log tiny local clock drifts; w/ help from Joerg Sonnenberger <joerg@britannica.bec.de>; henning@ ok
-rw-r--r-- | usr.sbin/ntpd/ntpd.8 | 12 | ||||
-rw-r--r-- | usr.sbin/ntpd/ntpd.c | 7 | ||||
-rw-r--r-- | usr.sbin/ntpd/ntpd.h | 3 |
3 files changed, 18 insertions, 4 deletions
diff --git a/usr.sbin/ntpd/ntpd.8 b/usr.sbin/ntpd/ntpd.8 index 4e9869a819e..7a2fecee3dd 100644 --- a/usr.sbin/ntpd/ntpd.8 +++ b/usr.sbin/ntpd/ntpd.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ntpd.8,v 1.10 2004/11/02 18:00:38 henning Exp $ +.\" $OpenBSD: ntpd.8,v 1.11 2004/12/06 20:57:17 mickey Exp $ .\" .\" Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> .\" @@ -41,6 +41,16 @@ as described in RFC 1305. uses the .Xr adjtime 2 system call to correct the local system time without causing time jumps. +Adjustments larger then 128ms are logged using +.Xr syslog 3 . +The threshold value is chosen to avoid local clock drift thrash the log files. +Should +.Nm +be started with +.Fl d +option all calls to +.Xr adjtime 2 +will be logged. .Pp .Nm is usually started at boot time, and can be enabled by diff --git a/usr.sbin/ntpd/ntpd.c b/usr.sbin/ntpd/ntpd.c index 6b6b0ca51da..4e7895929f0 100644 --- a/usr.sbin/ntpd/ntpd.c +++ b/usr.sbin/ntpd/ntpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.c,v 1.24 2004/11/10 11:27:54 henning Exp $ */ +/* $OpenBSD: ntpd.c,v 1.25 2004/12/06 20:57:17 mickey Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -306,8 +306,11 @@ ntpd_adjtime(double d) { struct timeval tv; + if (d >= (double)LOG_NEGLIGEE / 1000) + log_info("adjusting local clock by %fs", d); + else + log_debug("adjusting local clock by %fs", d); d_to_tv(d, &tv); - log_info("adjusting local clock by %fs", d); if (adjtime(&tv, NULL) == -1) log_warn("adjtime failed"); } diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h index 995341bca59..120ecabd0f0 100644 --- a/usr.sbin/ntpd/ntpd.h +++ b/usr.sbin/ntpd/ntpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ntpd.h,v 1.45 2004/12/06 16:52:33 mickey Exp $ */ +/* $OpenBSD: ntpd.h,v 1.46 2004/12/06 20:57:17 mickey Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -52,6 +52,7 @@ #define QUERYTIME_MAX 15 /* single query might take n secs max */ #define OFFSET_ARRAY_SIZE 8 #define SETTIME_MIN_OFFSET 180 /* min offset for settime at start */ +#define LOG_NEGLIGEE 128 /* negligible drift to not log (ms) */ enum client_state { STATE_NONE, |