summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorKevin Steves <stevesk@cvs.openbsd.org>2009-02-10 16:52:10 +0000
committerKevin Steves <stevesk@cvs.openbsd.org>2009-02-10 16:52:10 +0000
commit2c3a6fe4337ea980abcfd12820d34aaa0f5c9e54 (patch)
treef8ac52e1fc554c2238385a212bf8ec61b872698f /usr.sbin
parente7c8c1b37027f888879199578b809035cc94d89f (diff)
log tiny frequency adjustments at debug only.
ok henning@, 'I think I agree' otto@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ntpd/ntpd.c19
-rw-r--r--usr.sbin/ntpd/ntpd.h3
2 files changed, 16 insertions, 6 deletions
diff --git a/usr.sbin/ntpd/ntpd.c b/usr.sbin/ntpd/ntpd.c
index 5459777d543..cc9befaac9a 100644
--- a/usr.sbin/ntpd/ntpd.c
+++ b/usr.sbin/ntpd/ntpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.c,v 1.63 2009/02/06 21:48:00 stevesk Exp $ */
+/* $OpenBSD: ntpd.c,v 1.64 2009/02/10 16:52:09 stevesk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -380,6 +380,7 @@ void
ntpd_adjfreq(double relfreq, int wrlog)
{
int64_t curfreq;
+ double ppmfreq;
int r;
if (adjfreq(NULL, &curfreq) == -1) {
@@ -393,10 +394,18 @@ ntpd_adjfreq(double relfreq, int wrlog)
*/
curfreq += relfreq * 1e9 * (1LL << 32);
r = writefreq(curfreq / 1e9 / (1LL << 32));
- if (wrlog)
- log_info("adjusting clock frequency by %f to %fppm%s",
- relfreq * 1e6, curfreq / 1e3 / (1LL << 32),
- r ? "" : " (no drift file)");
+ ppmfreq = relfreq * 1e6;
+ if (wrlog) {
+ if (ppmfreq >= LOG_NEGLIGIBLE_ADJFREQ ||
+ ppmfreq <= -LOG_NEGLIGIBLE_ADJFREQ)
+ log_info("adjusting clock frequency by %f to %fppm%s",
+ ppmfreq, curfreq / 1e3 / (1LL << 32),
+ r ? "" : " (no drift file)");
+ else
+ log_debug("adjusting clock frequency by %f to %fppm%s",
+ ppmfreq, curfreq / 1e3 / (1LL << 32),
+ r ? "" : " (no drift file)");
+ }
if (adjfreq(&curfreq, NULL) == -1)
log_warn("adjfreq failed");
diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h
index cd182569e8f..4c037ab4705 100644
--- a/usr.sbin/ntpd/ntpd.h
+++ b/usr.sbin/ntpd/ntpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.h,v 1.97 2009/02/06 21:48:00 stevesk Exp $ */
+/* $OpenBSD: ntpd.h,v 1.98 2009/02/10 16:52:09 stevesk Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -56,6 +56,7 @@
#define SENSOR_OFFSETS 7
#define SETTIME_TIMEOUT 15 /* max seconds to wait with -s */
#define LOG_NEGLIGIBLE_ADJTIME 32 /* negligible drift to not log (ms) */
+#define LOG_NEGLIGIBLE_ADJFREQ 0.05 /* negligible rate to not log (ppm) */
#define FREQUENCY_SAMPLES 8 /* samples for est. of permanent drift */
#define MAX_FREQUENCY_ADJUST 128e-5 /* max correction per iteration */
#define REPORT_INTERVAL (24*60*60) /* interval between status reports */