[Git][NTPsec/ntpsec][master] ntpd: Fix another place good data being thrown away.

Gary E. Miller gitlab at mg.gitlab.com
Thu Oct 13 00:22:17 UTC 2016

Gary E. Miller pushed to branch master at NTPsec / ntpsec

67c2abda by Gary E. Miller at 2016-10-12T17:13:15-07:00
ntpd: Fix another place good data being thrown away.

ntpd assumed that no refclock measurement could be more precise
that sys_precision.  Measurements smaller than sys_precision were
replaced with sys_precision, even if the measure was zero or averaged.

This assumption is not valid when KPPS is used.  The KPPS timestamps
can be much more precise than sys_precision.  Sometimes more than 60%
of the good and precise data was being discarded.

Removing this bad code can be shown to decrease RMS Time Jitter
by a factor of 4 on a Raspberry Pi.

This problem became more obvious with Linux kernel 2.4.24 on RasPi.
This kernel degrades sys-precision from -20 to -19.  That moved the
floor of RMS Time Jitter from 1 micro second to 2.

- - - - -

1 changed file:

- ntpd/ntp_loopfilter.c


--- a/ntpd/ntp_loopfilter.c
+++ b/ntpd/ntp_loopfilter.c
@@ -667,10 +667,8 @@ local_clock(
 		 * differences.
 		etemp = SQUARE(clock_jitter);
-		dtemp = SQUARE(max(fabs(fp_offset - last_offset),
-		    LOGTOD(sys_precision)));
-		clock_jitter = SQRT(etemp + (dtemp - etemp) /
-		    CLOCK_AVG);
+		dtemp = SQUARE(fp_offset - last_offset);
+		clock_jitter = SQRT(etemp + (dtemp - etemp) / CLOCK_AVG);
 		switch (state) {

View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/67c2abdabfea27bd84bdf934ba68bb40560dbcbe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20161013/08157d16/attachment.html>

More information about the vc mailing list