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);
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 */
/*
* 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;
/*
* 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);
*
* 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.
* 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])
#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 */
* tacked on the end for clockstats display.
*/
up->tcswitch++;
- if (temp < LENARB)
+ if (up->tcswitch <= 1 || temp < LENARB)
return;
/*
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);
}
}