From: Harlan Stenn Date: Fri, 14 Oct 2005 20:08:06 +0000 (-0400) Subject: Updates from Dave Mills X-Git-Tag: NTP_4_2_0B_RC1~42^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e265288202f4c5e9471cb2860f456dfb4c13cfc2;p=thirdparty%2Fntp.git Updates from Dave Mills bk: 43501026c0QSX1JK9AoY_Mbd1cupdw --- diff --git a/ntpd/ntp_loopfilter.c b/ntpd/ntp_loopfilter.c index f51915dbb..8eaab4d14 100644 --- a/ntpd/ntp_loopfilter.c +++ b/ntpd/ntp_loopfilter.c @@ -346,18 +346,12 @@ local_clock( state = S_SPIK; /* fall through to S_SPIK/S_FREQ */ - /* - * In S_SPIK state we ignore succeeding outlyers until - * either an inlyer is found or the stepout threshold is - * exceeded. - * * In S_FREQ state we ignore outlyers and inlyers. At * the first outlyer after the stepout threshold, * compute the apparent frequency correction and step * the phase. */ - case S_SPIK: case S_FREQ: if (mu < clock_minstep) return (0); @@ -365,6 +359,17 @@ local_clock( clock_frequency = (fp_offset - last_base - clock_offset) / mu; + /* fall through to S_SPIK */ + + /* + * In S_SPIK state we ignore succeeding outlyers until + * either an inlyer is found or the stepout threshold is + * exceeded. + */ + case S_SPIK: + if (mu < clock_minstep) + return (0); + /* fall through to default */ /* @@ -751,7 +756,7 @@ adj_host_clock( * If NTP is disabled or ntpdate mode enabled or the kernel * discipline enabled, we have no business going further. */ - if (!ntp_enable || mode_ntpdate || (pll_control && kern_enable)) + if (!ntp_enable || mode_ntpdate || pll_control && kern_enable) return; /* @@ -925,7 +930,7 @@ loop_config( * is zero to cancel any previous nonsense. If you don't * want this initialization, remove the ntp.drift file. */ - if (pll_control) { + if (pll_control && kern_enable) { memset((char *)&ntv, 0, sizeof(ntv)); ntv.modes = MOD_FREQUENCY; ntv.freq = (int32)(drift_comp * 65536e6); diff --git a/ntpd/ntp_refclock.c b/ntpd/ntp_refclock.c index e2b2d9f09..c4cb99d79 100644 --- a/ntpd/ntp_refclock.c +++ b/ntpd/ntp_refclock.c @@ -504,7 +504,7 @@ refclock_process( * * This routine implements a recursive median filter to suppress spikes * in the data, as well as determine a performance statistic. It - * calculates the mean offset and jitter (squares). A time adjustment + * calculates the mean offset and RMS jitter. A time adjustment * fudgetime1 can be added to the final offset to compensate for various * systematic errors. The routine returns the number of samples * processed, which could be zero. @@ -545,7 +545,7 @@ refclock_sample( * approximately 60 percent of the samples remain. */ i = 0; j = n; - m = n - (n * 2) / NSTAGE; + m = n - (n * 4) / 10; while ((j - i) > m) { offset = off[(j + i) / 2]; if (off[j - 1] - offset < offset - off[i]) diff --git a/ntpd/refclock_arbiter.c b/ntpd/refclock_arbiter.c index 334ee1054..88a32250d 100644 --- a/ntpd/refclock_arbiter.c +++ b/ntpd/refclock_arbiter.c @@ -91,10 +91,8 @@ #define DEVICE "/dev/gps%d" /* device name and unit */ #define SPEED232 B9600 /* uart speed (9600 baud) */ #define PRECISION (-20) /* precision assumed (about 1 us) */ -#define REFID "GPS " /* reference ID */ +#define REFID "GPS " /* reference ID */ #define DESCRIPTION "Arbiter 1088A/B GPS Receiver" /* WRU */ -#define ARBSTAGE 40 /* median filter stages */ - #define LENARB 24 /* format B5 timecode length */ #define MAXSTA 40 /* max length of status string */ #define MAXPOS 80 /* max length of position string */ @@ -312,7 +310,7 @@ arb_receive( * tacked on the end for clockstats display. */ up->tcswitch++; - if (temp < LENARB) + if (up->tcswitch <= 1 || temp < LENARB) return; /* @@ -399,7 +397,8 @@ arb_receive( refclock_report(peer, CEVNT_BADTIME); else if (peer->disp > MAXDISTANCE) refclock_receive(peer); - if (up->tcswitch >= ARBSTAGE) { + + if (up->tcswitch >= MAXSTAGE) { write(pp->io.fd, "B0", 2); } }