From: Harlan Stenn Date: Thu, 19 Apr 2001 01:53:30 +0000 (-0000) Subject: ChangeLog, ntp_config.c, ntp_loopfilter.c, ntp_proto.c: X-Git-Tag: NTP_4_0_99_M~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff1724b7343ce2e33fbdeb07e37dcae358c807a8;p=thirdparty%2Fntp.git ChangeLog, ntp_config.c, ntp_loopfilter.c, ntp_proto.c: * ntpd/ntp_proto.c (clock_update): minpoll cleanup. (clock_select): minpoll cleanup. (clock_filter): Bugfixes from Mark Martinec * 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 --- diff --git a/ChangeLog b/ChangeLog index e91b6a2fb6..a071875c18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-04-18 Harlan Stenn + + * ntpd/ntp_proto.c (clock_update): minpoll cleanup. + (clock_select): minpoll cleanup. + (clock_filter): Bugfixes from Mark Martinec + * 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 * libntp/msyslog.c: diff --git a/ntpd/ntp_config.c b/ntpd/ntp_config.c index afb34bc971..dbc0b79513 100644 --- a/ntpd/ntp_config.c +++ b/ntpd/ntp_config.c @@ -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; diff --git a/ntpd/ntp_loopfilter.c b/ntpd/ntp_loopfilter.c index 7f76130440..ced19eb2c1 100644 --- a/ntpd/ntp_loopfilter.c +++ b/ntpd/ntp_loopfilter.c @@ -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; diff --git a/ntpd/ntp_proto.c b/ntpd/ntp_proto.c index 2a3522aaf1..0cc7ebc991 100644 --- a/ntpd/ntp_proto.c +++ b/ntpd/ntp_proto.c @@ -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");