<body>
<h3>Copyright Notice</h3>
- <img src="pic/sheepb.jpg" alt="jpg" align="left"> "Clone me," says Dolly sheepishly.<p>Last update: <csobj format="ShortTime" h="25" locale="00000409" region="0" t="DateTime" w="61">15:19</csobj> UTC <csobj format="LongDate" h="25" locale="00000409" region="0" t="DateTime" w="250">Sunday, March 02, 2008</csobj></p>
- <br clear="left">
+ <img src="pic/sheepb.jpg" alt="jpg" align="left"> "Clone me," says Dolly sheepishly.
+ <p>Last update:
+ <!-- #BeginDate format:En2m -->24-Sep-2009 16:04<!-- #EndDate -->
+ UTC</csobj></p>
+<br clear="left">
<hr>
<p>The following copyright notice applies to all files collectively called the Network Time Protocol Version 4 Distribution. Unless specifically declared otherwise in an individual file, this notice applies as if the text was explicitly included in the file.</p>
<pre>
<li class="inline"><a href="mailto:%20tmoore@fievel.daytonoh.ncr.com">Tom Moore <tmoore@fievel.daytonoh.ncr.com></a> i386 svr4 port
<li class="inline"><a href="mailto:%20kamal@whence.com">Kamal A Mostafa <kamal@whence.com></a> SCO OpenServer port
<li class="inline"><a href="mailto:%20derek@toybox.demon.co.uk">Derek Mulcahy <derek@toybox.demon.co.uk></a> and <a href="mailto:%20d@hd.org">Damon Hart-Davis <d@hd.org></a> ARCRON MSF clock driver
+ <li class="inline"><a href="mailto:%20neal@ntp.org">Rob Neal <neal@ntp.org></a> Bancomm refclock and config/parse code maintenance
<li class="inline"><a href="mailto:%20Rainer.Pruy@informatik.uni-erlangen.de">Rainer Pruy <Rainer.Pruy@informatik.uni-erlangen.de></a> monitoring/trap scripts, statistics file handling
<li class="inline"><a href="mailto:%20dirce@zk3.dec.com">Dirce Richards <dirce@zk3.dec.com></a> Digital UNIX V4.0 port
<li class="inline"><a href="mailto:%20wsanchez@apple.com">Wilfredo Sánchez <wsanchez@apple.com></a> added support for NetInfo
<li class="inline"><a href="mailto:%20tsuruoka@nc.fukuoka-u.ac.jp">Tomoaki TSURUOKA <tsuruoka@nc.fukuoka-u.ac.jp></a>TRAK clock driver
<li class="inline"><a href="mailto:%20vixie@vix.com">Paul A Vixie <vixie@vix.com></a> TrueTime GPS driver, generic TrueTime clock driver
<li class="inline"><a href="mailto:%20Ulrich.Windl@rz.uni-regensburg.de">Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de></a> corrected and validated HTML documents according to the HTML DTD
- <li class="inline"><a href="mailto:%20neal@ntp.org">Rob Neal <neal@ntp.org></a> Bancomm refclock and config/parse code maintenance
- </ol>
+ </ol>
<hr>
<script type="text/javascript" language="javascript" src="scripts/footer.txt"></script>
</body>
<img src="pic/boom3.gif" alt="gif" align="left"><a href="http://www.eecis.udel.edu/~mills/pictures.html">from <i>Pogo</i>, Walt Kelly</a>
<p>We have three, now looking for more.</p>
<p>Last update:
- <!-- #BeginDate format:En2m -->10-Sep-2009 20:11<!-- #EndDate -->
+ <!-- #BeginDate format:En2m -->25-Sep-2009 20:39<!-- #EndDate -->
UTC</p>
<br clear="left">
<h4>Related Links</h4>
<dt><tt>minclock <i>minclock</i></tt></dt>
<dd>Specify the number of servers used by the clustering algorithm as the minimum to include on the candidate list. The default is 3. This is also the number of servers to be averaged by the combining algorithm.</dd>
<dt><tt>mindist <i>mindistance</i></tt></dt>
- <dd>Specify the increment used by the selection algorithm to augment the correctness interval. The default is .005 s. In some cases, such as reference clocks with high jitter and a PPS signal, it is useful to increase the increment to insure the intersection interval is always nonempty.</dd>
+ <dd>Specify the minimum distance used by the selection and anticlockhop
+ algorithm. Larger values increase the tolerance for outliers;
+ smaller values increase the selectivity. The default is .001 s. In some
+ cases, such as reference clocks with high jitter and a PPS signal, it is
+ useful to increase the value to insure the intersection interval is
+ always nonempty.</dd>
<dt><tt>minsane <i>minsane</i></tt></dt>
<dd>Specify the number of servers used by the selection algorithm as the minimum to set the system clock. The default is 1 for legacy purposes; however, for critical applications the value should be somewhat higher but less than <tt>minclock</tt>.</dd>
<dt><tt>orphan <i>stratum</i></tt></dt>
double sys_maxdist = MAXDISTANCE; /* selection threshold */
double sys_jitter; /* system jitter */
u_long sys_epoch; /* last clock update time */
-static int sys_maxhop = MAXHOP; /* anticlockhop threshol */
+static double sys_clockhop; /* clockhop threshold */
int leap_tai; /* TAI at next next leap */
u_long leap_sec; /* next scheduled leap from file */
u_long leap_peers; /* next scheduled leap from peers */
* the maximum interval between minimum samples is eight
* packets.
*/
- if (peer->filter_epoch[k] > peer->epoch)
- peer->epoch = peer->filter_epoch[k];
+ if (peer->filter_epoch[k] <= peer->epoch) {
+#if DEBUG
+ if (debug)
+ printf("clock_filter: old sample %lu\n", current_time -
+ peer->filter_epoch[k]);
+#endif
+ return;
+ }
+ peer->epoch = peer->filter_epoch[k];
/*
* The mitigated sample statistics are saved for later
#ifdef DEBUG
if (debug)
printf(
- "clock_filter: n %d off %.6f del %.6f dsp %.6f jit %.6f, age %lu\n",
+ "clock_filter: n %d off %.6f del %.6f dsp %.6f jit %.6f\n",
m, peer->offset, peer->delay, peer->disp,
- peer->jitter, current_time - peer->filter_epoch[k]);
+ peer->jitter);
#endif
if (peer->burst == 0 || sys_leap == LEAP_NOTINSYNC)
clock_select();
*
* LOCKCLOCK: (1) If the local clock is the prefer peer, it will always
* be enabled, even if declared falseticker, (2) only the prefer peer
- * can be selected as the system peer, (3) if the external source is
+ * caN Be selected as the system peer, (3) if the external source is
* down, the system leap bits are set to 11 and the stratum set to
* infinity.
*/
#endif /* REFCLOCK */
/*
- * The metric is the scaled root distance plus the peer
- * stratum. For compliance with the specification, both
- * values are multiplied by the select threshold.
+ * The metric is the scaled root distance at the next
+ * poll interval plus the peer stratum.
*/
- d = (root_distance(peer) / sys_maxdist +
- peer->stratum) * sys_maxdist;
+ d = (root_distance(peer) + clock_phi * (peer->nextdate -
+ current_time)) / sys_maxdist + peer->stratum;
if (j >= NTP_MAXASSOC) {
if (d >= synch[j - 1])
continue;
* is always won.
*/
leap_vote = 0;
- j = 0;
for (i = 0; i < nlist; i++) {
peer = peer_list[i];
peer->unreach = 0;
else
leap_vote++;
}
- if (peer == osys_peer)
- j = i;
if (peer->flags & FLAG_PREFER)
sys_prefer = peer;
}
/*
- * Anticlockhop provisions. Ordinarily, use the first survivor
- * on the survivor list, if there is one, and if there are
- * least sys_minsane survivors. Othersie, there are no
- * survivors. However, if the previous system peer is on the
- * list but not first, use it if the synchronization distance
- * is not greater than the accumulation over the last
- * sys_maxhop * poll intervals. Do this only if there are at
- * least one kitten in the litter.
+ * Unless there are at least sys_misane survivors, leave the
+ * building dark. Otherwise, do a clockhop dance. Ordinarily,
+ * use the first survivor on the survivor list. However, if the
+ * last selection is not first on the list, use it as long as
+ * it doesn't get too old or too ugly.
*/
if (nlist > 0 && nlist >= sys_minsane) {
- if (synch[j] < synch[0] + ULOGTOD(sys_poll) *
- sys_maxhop * clock_phi)
- typesystem = peer_list[j];
- else
- typesystem = peer_list[0];
+ double x;
+ char tbuf[80];
+
+ typesystem = peer_list[0];
+ if (osys_peer == NULL || osys_peer == typesystem) {
+ sys_clockhop = 0;
+ } else if ((x = fabs(typesystem->offset -
+ osys_peer->offset)) < sys_mindisp) {
+ if (sys_clockhop == 0)
+ sys_clockhop = sys_mindisp;
+ else
+ sys_clockhop *= .5;
+#ifdef DEBUG
+ if (debug)
+ printf("select: clockhop %d %.6f %.6f\n",
+ j, x, sys_clockhop);
+#endif
+ if (fabs(x) < sys_clockhop) {
+ typesystem = osys_peer;
+ } else {
+ sprintf(tbuf, "%.6f", x);
+ report_event(EVNT_CLKHOP, NULL, tbuf);
+ sys_clockhop = 0;
+ }
+ } else {
+ sys_clockhop = 0;
+ }
}
/*
sys_ceiling = (int)dvalue;
break;
- case PROTO_MAXHOP: /* clockhop threshold (clockhop) */
- sys_maxhop = (int)dvalue;
- break;
-
case PROTO_COHORT: /* cohort switch (cohort) */
sys_cohort = (int)dvalue;
break;