]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
ChangeLog, ntp_config.c, ntp_loopfilter.c, ntp_proto.c:
authorHarlan Stenn <stenn@ntp.org>
Thu, 19 Apr 2001 01:53:30 +0000 (01:53 -0000)
committerHarlan Stenn <stenn@ntp.org>
Thu, 19 Apr 2001 01:53:30 +0000 (01:53 -0000)
  * ntpd/ntp_proto.c (clock_update): minpoll cleanup.
  (clock_select): minpoll cleanup.
  (clock_filter): Bugfixes from Mark Martinec <Mark.Martinec@ijs.si>
  * ntpd/ntp_loopfilter.c (rstclock): minpoll cleanup.  Debug cleanup.
  * ntpd/ntp_config.c (getconfig): Initialize/bounds check minpoll
  using NTP_MINDPOLL insted of sys_minpoll.
  From: Dave Mills.

bk: 3ade451as-WPFFl3OYrnIejxruy4Hw

ChangeLog
ntpd/ntp_config.c
ntpd/ntp_loopfilter.c
ntpd/ntp_proto.c

index e91b6a2fb6a4410c9dd4bb0ac6006aedd5e38078..a071875c189cb196608f9c292bfd6f01f1aa35c9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2001-04-18  Harlan Stenn  <stenn@whimsy.udel.edu>
+
+       * ntpd/ntp_proto.c (clock_update): minpoll cleanup.
+       (clock_select): minpoll cleanup.
+       (clock_filter): Bugfixes from Mark Martinec <Mark.Martinec@ijs.si>
+       * ntpd/ntp_loopfilter.c (rstclock): minpoll cleanup.  Debug cleanup.
+       * ntpd/ntp_config.c (getconfig): Initialize/bounds check minpoll
+       using NTP_MINDPOLL insted of sys_minpoll.
+       From: Dave Mills.
+
 2001-04-17  Harlan Stenn  <stenn@whimsy.udel.edu>
 
        * libntp/msyslog.c:
index afb34bc971d3fe8fc738ec57ec0e09cf937a35f4..dbc0b79513fde09001588e04fdc3fb9cfeb39a1a 100644 (file)
@@ -651,7 +651,7 @@ getconfig(
                        }
                        
                        peerversion = NTP_VERSION;
-                       minpoll = sys_minpoll;
+                       minpoll = NTP_MINDPOLL;
                        maxpoll = NTP_MAXDPOLL;
                        peerkey = 0;
                        peerkeystr = "*";
@@ -695,11 +695,11 @@ getconfig(
                                            break;
                                    }
                                    minpoll = atoi(tokens[++i]);
-                                   if (minpoll < sys_minpoll) {
+                                   if (minpoll < NTP_MINPOLL) {
                                            msyslog(LOG_INFO,
                                                    "minpoll: provided value (%d) is below minimum (%d)",
-                                                   minpoll, sys_minpoll);
-                                       minpoll = sys_minpoll;
+                                                   minpoll, NTP_MINPOLL);
+                                       minpoll = NTP_MINPOLL;
                                    }
                                    break;
 
index 7f76130440b66d5b9c44ce3b3225ebab4a0bcfa0..ced19eb2c1d6499c62d57719b52e4d656fac0dc0 100644 (file)
@@ -439,8 +439,6 @@ local_clock(
                }
        }
 
-printf("uuu\n");
-
 #if defined(KERNEL_PLL)
        /*
         * This code segment works when clock adjustments are made using
@@ -587,6 +585,9 @@ printf("uuu\n");
        clock_stability = SQRT(dtemp + etemp / CLOCK_AVG);
        allan_xpt = max(CLOCK_ALLAN, clock_stability * CLOCK_ADF);
 
+printf("xxx %.3f %.3f\n", sys_jitter / ULOGTOD(sys_poll + 1),
+clock_stability * 1.5);
+
        /*
         * In SYNC state, adjust the poll interval.
         */
@@ -719,7 +720,7 @@ rstclock(
         * measurements.
         */ 
        case S_FREQ:
-               sys_poll = sys_minpoll;
+               sys_poll = NTP_MINPOLL;
                allan_xpt = CLOCK_ALLAN;
                last_time = current_time;
                break;
@@ -728,7 +729,7 @@ rstclock(
         * Synchronized mode. Discipline the poll interval.
         */
        case S_SYNC:
-               sys_poll = sys_minpoll;
+               sys_poll = NTP_MINPOLL;
                allan_xpt = CLOCK_ALLAN;
                tc_counter = 0;
                break;
@@ -745,7 +746,7 @@ rstclock(
         * the time reference for future frequency updates.
         */
        default:
-               sys_poll = sys_minpoll;
+               sys_poll = NTP_MINPOLL;
                allan_xpt = CLOCK_ALLAN;
                last_time = current_time;
                last_offset = clock_offset = 0;
index 2a3522aaf1e9be7b36c23a7a650aec58e98383bc..0cc7ebc991b06440b43c3faed3691f2edee36462 100644 (file)
@@ -1067,7 +1067,7 @@ clock_update(void)
                clear_all();
                sys_peer = NULL;
                sys_stratum = STRATUM_UNSPEC;
-               sys_poll = sys_minpoll;
+               sys_poll = NTP_MINPOLL;
                NLOG(NLOG_SYNCSTATUS)
                    msyslog(LOG_INFO, "synchronisation lost");
                report_event(EVNT_CLOCKRESET, (struct peer *)0);
@@ -1274,24 +1274,25 @@ peer_clear(
  */
 void
 clock_filter(
-       register struct peer *peer,
-       double sample_offset,
-       double sample_delay,
-       double sample_disp
+       register struct peer *peer,     /* peer structure pointer */
+       double sample_offset,           /* clock offset */
+       double sample_delay,            /* roundtrip delay */
+       double sample_disp              /* dispersion */
        )
 {
+       double dst[NTP_SHIFT];          /* distance vector */
+       int ord[NTP_SHIFT];             /* index vector */
        register int i, j, k, m;
-       int ord[NTP_SHIFT];
-       double dst[NTP_SHIFT];
        double off, dly, dsp, jit, dtemp, etemp, ftemp;
 
        /*
         * Shift the new sample into the register and discard the oldest
-        * one. The new offset and delay come directly from the caller.
-        * The caller delay can sometimes swing negative due to
-        * frequency skew, so it is clamped non-negative. The dispersion
-        * from the caller is increased by the sum of the peer precision
-        * and the system precision.
+        * one. The new offset and delay come directly from the
+        * timestamp calculations. The dispersion grows from the last
+        * outbound packet or reference clock update to the present time
+        * and increased by the sum of the peer precision and the system
+        * precision. The delay can sometimes swing negative due to
+        * frequency skew, so it is clamped non-negative.
         */
        dsp = min(LOGTOD(peer->precision) + LOGTOD(sys_precision) +
            sample_disp, MAXDISPERSE);
@@ -1307,13 +1308,13 @@ clock_filter(
         * Update dispersions since the last update and at the same
         * time initialize the distance and index vectors. The distance
         * is a compound metric: If the sample dispersion is less than
-        * MAXDISTANCE younger than the Allan intercept, use delay.
+        * MAXDISTANCE and younger than the Allan intercept, use delay.
         * Otherwise, use MAXDISTANCE plus conventional distance.
         */
        dtemp = clock_phi * (current_time - peer->update);
        etemp = min(allan_xpt, NTP_SHIFT * ULOGTOD(sys_poll));
        peer->update = current_time;
-       for (i = 0; i < NTP_SHIFT; i++) {
+       for (i = NTP_SHIFT - 1; i >= 0; i--) {
                if (i != 0) {
                        peer->filter_disp[j] += dtemp;
                        if (peer->filter_disp[j] > MAXDISPERSE)
@@ -1321,8 +1322,8 @@ clock_filter(
                }
                ftemp = peer->filter_delay[j] / 2. +
                    peer->filter_disp[j];
-               if (ftemp < MAXDISTANCE || current_time -
-                   peer->filter_epoch[j] < dtemp)
+               if (ftemp < MAXDISTANCE && current_time -
+                   peer->filter_epoch[j] < etemp)
                        dst[i] = peer->filter_delay[j];
                else
                        dst[i] = MAXDISTANCE + ftemp;
@@ -1331,7 +1332,7 @@ clock_filter(
        }
 
         /*
-        * Sort the samples in the register by the compound metric.
+        * Sort the sampsamples in the register by the compound metric.
         */
        for (i = 1; i < NTP_SHIFT; i++) {
                for (j = 0; j < i; j++) {
@@ -1355,7 +1356,7 @@ clock_filter(
 #if DEBUG
                if (debug > 1) {
                        j = ord[i];
-                       printf("clock_filter: %d %d %f %f %f %f\n", i,
+                       printf("cfilter: %d %d %f %f %f %f\n", i,
                            j, dst[i], peer->filter_offset[j],
                            peer->filter_delay[j],
                            peer->filter_disp[j]);
@@ -1672,7 +1673,7 @@ clock_select(void)
                        nlist = 1;
                } else {
                        if (osys_peer != NULL) {
-                               sys_poll = sys_minpoll;
+                               sys_poll = NTP_MINPOLL;
                                NLOG(NLOG_SYNCSTATUS)
                                    msyslog(LOG_INFO,
                                    "synchronisation lost");