#define BURST_INTERVAL1 4 /* first interburst interval (log2) */
#define BURST_INTERVAL2 1 /* succeeding interburst intervals (log2) */
#define HUFFPUFF 900 /* huff-n'-puff sample interval (s) */
+#define HYST .5 /* anti-clockhop hysteresis */
+#define HYST_TC .5 /* anti-clockhop hysteresis decay factor */
/*
* Operations for jitter calculations (these use doubles).
double jitter; /* peer jitter (squares) */
double disp; /* peer dispersion */
double estbdelay; /* clock offset to broadcast server */
+ double hyst; /* anti-clockhop hysteresis */
/*
* Variables set by received packet
peer->flags |= FLAG_CLUST;
oreach = peer->reach;
peer->reach <<= 1;
+ peer->hyst *= HYST_TC;
if (peer->reach == 0) {
/*
* drowned as well, but only if at at least eight poll intervals
* have gone by. We must leave at least one peer to collect the
* million bucks.
+ *
+ * Note the hysteresis gimmick that decreases the effective
+ * distance for those rascals that previously have made the
+ * final cut. This to discourage clockhopping.
*/
j = 0;
for (i = 0; i < nlist; i++) {
continue;
}
peer->status = CTL_PST_SEL_DISTSYSPEER;
- d = root_distance(peer) + peer->stratum * MAXDISPERSE;
+ d = (1. - peer->hyst) * root_distance(peer) +
+ peer->stratum * MAXDISPERSE;
if (j >= NTP_MAXCLOCK) {
if (d >= synch[j - 1])
continue;
peer = peer_list[i];
peer->status = CTL_PST_SEL_SYNCCAND;
peer->flags |= FLAG_SYSPEER;
+ peer->hyst = HYST;
poll_update(peer, peer->hpoll);
if (peer->stratum == peer_list[0]->stratum) {
leap_consensus |= peer->leap;