Blame SOURCES/chrony-phcdelay.patch

ab3630
commit abb09418b16993ecd8289dd459dff91701f4f971
ab3630
Author: Miroslav Lichvar <mlichvar@redhat.com>
ab3630
Date:   Wed Apr 19 12:20:14 2017 +0200
ab3630
ab3630
    sys_linux: don't drop PHC samples with zero delay
ab3630
    
ab3630
    When processing data from the PTP_SYS_OFFSET ioctl, the sample is
ab3630
    dropped when an interval between two consecutive readings of the system
ab3630
    clock is negative or zero, assuming the clock has been stepped between
ab3630
    the two readings.
ab3630
    
ab3630
    With a real PHC the interval is normally expected to be at least a
ab3630
    microsecond, but with a virtual PHC and a low-resolution system clock
ab3630
    it's possible to get two readings with the same system time. Modify the
ab3630
    check to drop only samples with a negative delay.
ab3630
ab3630
diff --git a/sys_linux.c b/sys_linux.c
ab3630
index c06112a..649afb0 100644
ab3630
--- a/sys_linux.c
ab3630
+++ b/sys_linux.c
ab3630
@@ -705,9 +705,11 @@ get_phc_sample(int phc_fd, double precision, struct timespec *phc_ts,
ab3630
     phc_tss[i] = ts2;
ab3630
     delays[i] = UTI_DiffTimespecsToDouble(&ts3, &ts1;;
ab3630
 
ab3630
-    if (delays[i] <= 0.0)
ab3630
+    if (delays[i] < 0.0) {
ab3630
       /* Step in the middle of a PHC reading? */
ab3630
+      DEBUG_LOG(LOGF_SysLinux, "Bad PTP_SYS_OFFSET sample delay=%e", delays[i]);
ab3630
       return 0;
ab3630
+    }
ab3630
 
ab3630
     if (!i || delays[i] < min_delay)
ab3630
       min_delay = delays[i];