summaryrefslogtreecommitdiffstats
path: root/contrib/ntp/ntpd/ntp_loopfilter.c
diff options
context:
space:
mode:
authorroberto <roberto@FreeBSD.org>2000-01-28 14:55:50 +0000
committerroberto <roberto@FreeBSD.org>2000-01-28 14:55:50 +0000
commitb5b40f9e420899251189775800d9f74092925299 (patch)
tree98efdf1b74d6ecb7828bb502a0350116eeb2fd3c /contrib/ntp/ntpd/ntp_loopfilter.c
parentef64b99e8412f2273dd2e8b3291c2f78ffc4667f (diff)
downloadFreeBSD-src-b5b40f9e420899251189775800d9f74092925299.zip
FreeBSD-src-b5b40f9e420899251189775800d9f74092925299.tar.gz
Virgin import of ntpd 4.0.99b
Diffstat (limited to 'contrib/ntp/ntpd/ntp_loopfilter.c')
-rw-r--r--contrib/ntp/ntpd/ntp_loopfilter.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/contrib/ntp/ntpd/ntp_loopfilter.c b/contrib/ntp/ntpd/ntp_loopfilter.c
index 6e0e134..15b625d 100644
--- a/contrib/ntp/ntpd/ntp_loopfilter.c
+++ b/contrib/ntp/ntpd/ntp_loopfilter.c
@@ -194,7 +194,7 @@ local_clock(
#ifndef SYS_WINNT
if (fabs(fp_offset) >= clock_panic && !correct_any) {
msyslog(LOG_ERR,
- "time error %.0f over %d seconds; set clock manually)",
+ "time error %.0f over %d seconds; set clock manually",
fp_offset, (int)clock_panic);
return (-1);
}
@@ -286,7 +286,7 @@ local_clock(
* reset or shaken, but never stirred.
*/
default:
- if (allow_set_backward) {
+ if (allow_set_backward | correct_any) {
step_systime(fp_offset);
NLOG(NLOG_SYNCEVENT|NLOG_SYSEVENT)
msyslog(LOG_NOTICE, "time reset %.6f s",
@@ -299,7 +299,6 @@ local_clock(
fp_offset);
rstclock(S_FREQ);
last_offset = clock_offset = fp_offset;
- return (0);
}
break;
}
@@ -355,7 +354,8 @@ local_clock(
ULOGTOD(sys_poll + 1)) {
#ifdef DEBUG
if (debug)
- printf("local_clock: popcorn %.6f %.6f\n",
+ printf(
+ "local_clock: popcorn %.6f %.6f\n",
fp_offset, last_offset);
#endif
last_offset = fp_offset;
@@ -364,14 +364,17 @@ local_clock(
/*
* Compute the FLL and PLL frequency adjustments
- * conditioned on two weighting factors, one
- * which limits the time constant determined
- * from the Allan intercept, the other which
- * limits the gain factor as a function of
- * update interval. The net effect is to favor
- * the PLL adjustments at the smaller update
- * intervals and the FLL adjustments at the
- * larger ones.
+ * conditioned on intricate weighting factors.
+ * For the FLL, the averaging interval is
+ * clamped not to decrease below the Allan
+ * intercept and the gain is decreased from
+ * unity for mu above CLOCK_MINSEC (1024 s) to
+ * zero below CLOCK_MINSEC (256 s). For the PLL,
+ * the averaging interval is clamped not to
+ * exceed the sustem poll interval. These
+ * measures insure stability of the clock
+ * discipline even when the rules of fair
+ * engagement are broken.
*/
dtemp = max(mu, allan_xpt);
etemp = min(max(0, mu - CLOCK_MINSEC) /
@@ -379,7 +382,8 @@ local_clock(
flladj = fp_offset * etemp / (dtemp *
CLOCK_AVG);
dtemp = ULOGTOD(SHIFT_PLL + 2 + sys_poll);
- plladj = fp_offset * mu / (dtemp * dtemp);
+ etemp = min(mu, ULOGTOD(sys_poll));
+ plladj = fp_offset * etemp / (dtemp * dtemp);
clock_offset = fp_offset;
break;
}
@@ -664,6 +668,7 @@ rstclock(
int trans /* new state */
)
{
+ correct_any = FALSE;
state = trans;
switch (state) {
OpenPOWER on IntegriCloud