summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd/ntp.c
diff options
context:
space:
mode:
authorChris Kuethe <ckuethe@cvs.openbsd.org>2009-06-04 23:39:47 +0000
committerChris Kuethe <ckuethe@cvs.openbsd.org>2009-06-04 23:39:47 +0000
commit26f0220097c6a850e0ebd2de444f991280e50602 (patch)
tree6bb0b1a129081bc03ba16487e683ea1ea1258591 /usr.sbin/ntpd/ntp.c
parent6260330c332daf1197d0218472e43fd2e7750645 (diff)
After calling adjfreq to correct the clock's rate, measure and fix the clock
offset. This avoids future frequency adjustments based on measurements of a clock that was being adjusted. End result: more stable clock and better frequency convergence. Also, fix a mis-ordered structure member while I'm here. ok henning
Diffstat (limited to 'usr.sbin/ntpd/ntp.c')
-rw-r--r--usr.sbin/ntpd/ntp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c
index 7e9eff3b92c..4144bd7afa2 100644
--- a/usr.sbin/ntpd/ntp.c
+++ b/usr.sbin/ntpd/ntp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntp.c,v 1.110 2009/01/26 11:51:50 henning Exp $ */
+/* $OpenBSD: ntp.c,v 1.111 2009/06/04 23:39:45 ckuethe Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -530,6 +530,11 @@ priv_adjfreq(double offset)
if (!conf->status.synced)
return;
+ if (conf->filters & FILTER_ADJFREQ){
+ conf->filters &= ~FILTER_ADJFREQ;
+ return;
+ }
+
conf->freq.samples++;
if (conf->freq.samples <= 0)
@@ -558,6 +563,7 @@ priv_adjfreq(double offset)
freq = -MAX_FREQUENCY_ADJUST;
imsg_compose(ibuf_main, IMSG_ADJFREQ, 0, 0, &freq, sizeof(freq));
+ conf->filters |= FILTER_ADJFREQ;
conf->freq.xy = 0.0;
conf->freq.x = 0.0;
conf->freq.y = 0.0;