]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
cleanup from Dave Mills
authorHarlan Stenn <stenn@ntp.org>
Tue, 28 Dec 2004 05:46:27 +0000 (00:46 -0500)
committerHarlan Stenn <stenn@ntp.org>
Tue, 28 Dec 2004 05:46:27 +0000 (00:46 -0500)
bk: 41d0f333Zjv3UGYSUSKzYjmQpSbkPg

ntpd/refclock_acts.c
ntpd/refclock_atom.c
ntpd/refclock_wwv.c

index 745d2a6680f44996bd13b24e481371c7294e8b88..e18b16c3bf1435831eef7f681be5a63997f10eee 100644 (file)
@@ -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);
index 19ad43cc2088e4e3f2cc4236fd21dce3d88d6506..6d7bd441f0a484ec7f4a1b8dbefbfeb57cae6ab7 100644 (file)
@@ -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;
        }
index 9c153445ac79cf41c47f861ec837144f87578853..3ea702d4273d4e2f7df5ca9af3ea7a237ad1ebca 100644 (file)
  */
 #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 */
 
  */
 #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);