]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: improve dispersion calculation
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 4 Jan 2017 14:40:52 +0000 (15:40 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Fri, 6 Jan 2017 12:12:19 +0000 (13:12 +0100)
Instead of adding precision (sum of the local and remote precision) to
the TX and RX timestamp error, include only the maximum.

ntp_core.c

index fd22cc0004e7bd08e81a4c93fd6556917b425adf..ed8c85f4d6b3ccc63ab184537d329882099d5acd 100644 (file)
@@ -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 */