mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:35:06 -05:00
ntp+hwclock: add margin to estimated delay quantiles
Extend the interval of accepted delays by half of the quantile minimum step in both directions to make room for floating-point errors in the quantile calculation and an error that will be intentionally added in the next commit.
This commit is contained in:
@@ -199,8 +199,10 @@ HCL_ProcessReadings(HCL_Instance clock, int n_readings, struct timespec tss[][3]
|
||||
|
||||
local_prec = LCL_GetSysPrecisionAsQuantum();
|
||||
|
||||
low_delay = QNT_GetQuantile(clock->delay_quants, QNT_GetMinK(clock->delay_quants));
|
||||
high_delay = QNT_GetQuantile(clock->delay_quants, QNT_GetMaxK(clock->delay_quants));
|
||||
low_delay = QNT_GetQuantile(clock->delay_quants, QNT_GetMinK(clock->delay_quants)) -
|
||||
QNT_GetMinStep(clock->delay_quants) / 2.0;
|
||||
high_delay = QNT_GetQuantile(clock->delay_quants, QNT_GetMaxK(clock->delay_quants)) +
|
||||
QNT_GetMinStep(clock->delay_quants) / 2.0;
|
||||
low_delay = MIN(low_delay, high_delay);
|
||||
high_delay = MAX(high_delay, low_delay + local_prec);
|
||||
|
||||
|
||||
@@ -1742,7 +1742,7 @@ check_delay_quant(NCR_Instance inst, double delay)
|
||||
|
||||
quant = QNT_GetQuantile(inst->delay_quant, QNT_GetMinK(inst->delay_quant));
|
||||
|
||||
if (delay <= quant)
|
||||
if (delay <= quant + QNT_GetMinStep(inst->delay_quant) / 2.0)
|
||||
return 1;
|
||||
|
||||
DEBUG_LOG("maxdelayquant: delay=%e quant=%e", delay, quant);
|
||||
|
||||
Reference in New Issue
Block a user