]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Updates from Dave Mills
authorHarlan Stenn <stenn@ntp.org>
Fri, 14 Oct 2005 20:08:06 +0000 (16:08 -0400)
committerHarlan Stenn <stenn@ntp.org>
Fri, 14 Oct 2005 20:08:06 +0000 (16:08 -0400)
bk: 43501026c0QSX1JK9AoY_Mbd1cupdw

ntpd/ntp_loopfilter.c
ntpd/ntp_refclock.c
ntpd/refclock_arbiter.c

index f51915dbbc49c100a3e44e8d9096c9326cd24c0e..8eaab4d14e4ecb6b066afecef855a22dfd5e8e1f 100644 (file)
@@ -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);
index e2b2d9f09d9c83e975620fe769789b7ffe2115c1..c4cb99d79bc8676cb2fe125b39eb845b8033031d 100644 (file)
@@ -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])
index 334ee10549879c5fc263466cd0f741f793dca65f..88a32250df3c607f2d7cbb19ec0fc0049173a0ec 100644 (file)
 #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);
        }
 }