From: Miroslav Lichvar Date: Wed, 4 Jan 2017 14:40:52 +0000 (+0100) Subject: ntp: improve dispersion calculation X-Git-Tag: 3.0-pre3~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=96cc80ffc87701dc0eaeccf2cf5e387436b13d5b;p=thirdparty%2Fchrony.git ntp: improve dispersion calculation Instead of adding precision (sum of the local and remote precision) to the TX and RX timestamp error, include only the maximum. --- diff --git a/ntp_core.c b/ntp_core.c index fd22cc00..ed8c85f4 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -1435,7 +1435,8 @@ receive_packet(NCR_Instance inst, NTP_Local_Address *local_addr, skew = (source_freq_hi - source_freq_lo) / 2.0; /* and then calculate peer dispersion */ - dispersion = precision + inst->local_tx.err + rx_ts_err + skew * fabs(local_interval); + dispersion = MAX(precision, MAX(inst->local_tx.err, rx_ts_err)) + + skew * fabs(local_interval); /* Additional tests required to pass before accumulating the sample */