From: Harlan Stenn Date: Tue, 28 Dec 2004 05:46:27 +0000 (-0500) Subject: cleanup from Dave Mills X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c810f6af9ffebbd9f4efca705a2a55c25889a90f;p=thirdparty%2Fntp.git cleanup from Dave Mills bk: 41d0f333Zjv3UGYSUSKzYjmQpSbkPg --- diff --git a/ntpd/refclock_acts.c b/ntpd/refclock_acts.c index 745d2a6680..e18b16c3bf 100644 --- a/ntpd/refclock_acts.c +++ b/ntpd/refclock_acts.c @@ -769,6 +769,8 @@ acts_timeout( if (!io_addclock(&pp->io)) { msyslog(LOG_ERR, "acts: addclock fails"); + close(fd); + pp->io.fd = 0; break; } } @@ -899,7 +901,7 @@ acts_disc ( ioctl(pp->io.fd, TIOCMBIC, (char *)&dtr); } if (pp->sloppyclockflag & CLK_FLAG2) { - close(pp->io.fd); + io_closeclock(&pp->io); pp->io.fd = 0; sprintf(lockfile, LOCKFILE, up->unit); unlink(lockfile); diff --git a/ntpd/refclock_atom.c b/ntpd/refclock_atom.c index 19ad43cc20..6d7bd441f0 100644 --- a/ntpd/refclock_atom.c +++ b/ntpd/refclock_atom.c @@ -482,7 +482,7 @@ atom_poll( * Valid time is returned only if the prefer peer has survived * the intersection algorithm and within 0.5 s of local time * and not too long ago. This ensures the PPS time is within - * +-0.5 s of the local time and the seconds numbering is + * 0.5 s of the local time and the seconds numbering is * unambiguous. Note that the leap bits are set no-warning on * the first valid update and the stratum is set at the prefer * peer, unless overriden by a fudge command. @@ -496,7 +496,7 @@ atom_poll( pp->codeproc = pp->coderecv; return; - } else if (fabs(sys_prefer->offset) > 0.5) { + } else if (fabs(sys_prefer->offset) >= 0.5) { pp->codeproc = pp->coderecv; return; } diff --git a/ntpd/refclock_wwv.c b/ntpd/refclock_wwv.c index 9c153445ac..3ea702d427 100644 --- a/ntpd/refclock_wwv.c +++ b/ntpd/refclock_wwv.c @@ -159,7 +159,7 @@ */ #define ACQSN 5 /* station acquisition timeout */ #define DATA 4 /* data sync timeout */ -#define SYNCH 30 /* station sync timeout */ +#define SYNCH 60 /* station sync timeout */ #define HOLD 30 /* second sync holdover timeout */ #define PANIC (2 * 1440) /* panic timeout */ @@ -201,7 +201,7 @@ */ #define MINAVG 8 /* min averaging time */ #define MAXAVG 1024 /* max averaging time */ -#define FCONST 4 /* frequency time constant */ +#define FCONST 3 /* frequency time constant */ #define TCONST 16 /* data bit/digit time constant */ /* @@ -1268,7 +1268,7 @@ wwv_rf( * energy at the maximum value. */ dtemp = (epobuf[epoch] += (mfsync - epobuf[epoch]) / - (up->avgint * FCONST)); + up->avgint); if (dtemp > epomax) { epomax = dtemp; epopos = epoch; @@ -1457,12 +1457,6 @@ wwv_qrz( * over all 8000 samples in the second comb filter. To assure accurate * and reliable time and frequency discipline, this routine performs a * great deal of heavy-handed heuristic data filtering and grooming. - * - * Note that, since the minute sync pulse is very wide (800 ms), precise - * minute sync epoch acquisition requires at least a rough estimate of - * the second sync pulse (5 ms). This becomes more important in choppy - * conditions at the lower frequencies at night, since sferics and - * cochannel crude can badly distort the minute pulse. */ static void wwv_endpoc( @@ -1608,27 +1602,17 @@ wwv_endpoc( * the counter increments to +3, the averaging interval is * doubled and the counter set to zero; if it decrements to -3, * the interval is halved and the counter set to zero. - * - * Here be spooks. From careful observations, the epoch - * sometimes makes a long run of identical samples, then takes a - * lurch due apparently to lost interrupts or spooks. If this - * happens, the epoch change times the maximum run length will - * be greater than the averaging interval, so the lurch should - * be believed but the frequency left alone. Really intricate - * here. */ if (maxrun == 0) mepoch = up->tepoch; dtemp = (mepoch - zepoch) % SECOND; if (up->status & FGATE) { if (abs(dtemp) < MAXFREQ * MINAVG) { - if (maxrun * abs(dtemp) < avgcnt) { - up->freq += dtemp / avgcnt; - if (up->freq > MAXFREQ) - up->freq = MAXFREQ; - else if (up->freq < -MAXFREQ) - up->freq = -MAXFREQ; - } + up->freq += dtemp / (avgcnt * FCONST); + if (up->freq > MAXFREQ) + up->freq = MAXFREQ; + else if (up->freq < -MAXFREQ) + up->freq = -MAXFREQ; if (abs(dtemp) < MAXFREQ * MINAVG / 2.) { if (avginc < 3) { avginc++; @@ -1652,7 +1636,7 @@ wwv_endpoc( } if (pp->sloppyclockflag & CLK_FLAG4) { sprintf(tbuf, - "wwv2 %04x %4.0f %4d %4d %2d %4d %4.0f %6.1f", + "wwv2 %04x %4.0f %4d %4d %2d %4d %4.0f %7.2f", up->status, up->epomax, mepoch, maxrun, avginc, avgcnt, dtemp, up->freq * 1e6 / SECOND); record_clock_stats(&peer->srcadr, tbuf);