ntp: rework calculation and testing of peer delay
Instead of a worst-case delay use a mean value and relate it to the source's time. This makes it more stable in the interleaved and symmetric modes, which should improve the weighting and asymmetry correction. Modify the test A and B to work with a minimum estimated delay (delay - dispersion).
This commit is contained in:
parent
979b53866d
commit
23a4e8b38d
1 changed files with 10 additions and 10 deletions
20
ntp_core.c
20
ntp_core.c
|
@ -1408,10 +1408,9 @@ receive_packet(NCR_Instance inst, NTP_Local_Address *local_addr,
|
||||||
sample_rx_tss = rx_ts->source;
|
sample_rx_tss = rx_ts->source;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In our case, we work out 'delay' as the worst case delay,
|
/* Work out 'delay' relative to the source's time */
|
||||||
assuming worst case frequency error between us and the other
|
delay = (1.0 - (source_freq_lo + source_freq_hi) / 2.0) *
|
||||||
source */
|
local_interval - remote_interval;
|
||||||
delay = local_interval - remote_interval * (1.0 + source_freq_lo);
|
|
||||||
|
|
||||||
/* Clamp delay to avoid misleading results later */
|
/* Clamp delay to avoid misleading results later */
|
||||||
delay = fabs(delay);
|
delay = fabs(delay);
|
||||||
|
@ -1440,11 +1439,12 @@ receive_packet(NCR_Instance inst, NTP_Local_Address *local_addr,
|
||||||
|
|
||||||
/* Additional tests required to pass before accumulating the sample */
|
/* Additional tests required to pass before accumulating the sample */
|
||||||
|
|
||||||
/* Test A requires that the peer delay is not larger than the configured
|
/* Test A requires that the minimum estimate of the peer delay is not
|
||||||
maximum, in client mode that the server processing time is sane, and in
|
larger than the configured maximum, in client mode that the server
|
||||||
interleaved symmetric mode that the delay is not longer than half of the
|
processing time is sane, and in the interleaved symmetric mode that
|
||||||
remote polling interval to detect missed packets */
|
the delay is not longer than half of the remote polling interval to
|
||||||
testA = delay <= inst->max_delay &&
|
detect missed packets */
|
||||||
|
testA = delay - dispersion <= inst->max_delay &&
|
||||||
!(inst->mode == MODE_CLIENT && server_interval > MAX_SERVER_INTERVAL) &&
|
!(inst->mode == MODE_CLIENT && server_interval > MAX_SERVER_INTERVAL) &&
|
||||||
!(inst->mode == MODE_ACTIVE && interleaved_packet &&
|
!(inst->mode == MODE_ACTIVE && interleaved_packet &&
|
||||||
delay > UTI_Log2ToDouble(message->poll - 1));
|
delay > UTI_Log2ToDouble(message->poll - 1));
|
||||||
|
@ -1453,7 +1453,7 @@ receive_packet(NCR_Instance inst, NTP_Local_Address *local_addr,
|
||||||
minimum one currently in the stats data register is less than an
|
minimum one currently in the stats data register is less than an
|
||||||
administrator-defined value */
|
administrator-defined value */
|
||||||
testB = inst->max_delay_ratio <= 1.0 ||
|
testB = inst->max_delay_ratio <= 1.0 ||
|
||||||
delay / SST_MinRoundTripDelay(stats) <= inst->max_delay_ratio;
|
(delay - dispersion) / SST_MinRoundTripDelay(stats) <= inst->max_delay_ratio;
|
||||||
|
|
||||||
/* Test C requires that the ratio of the increase in delay from the minimum
|
/* Test C requires that the ratio of the increase in delay from the minimum
|
||||||
one in the stats data register to the standard deviation of the offsets
|
one in the stats data register to the standard deviation of the offsets
|
||||||
|
|
Loading…
Reference in a new issue