sys_linux: don't drop PHC samples with zero delay
When processing data from the PTP_SYS_OFFSET ioctl, the sample is dropped when an interval between two consecutive readings of the system clock is negative or zero, assuming the clock has been stepped between the two readings. With a real PHC the interval is normally expected to be at least a microsecond, but with a virtual PHC and a low-resolution system clock it's possible to get two readings with the same system time. Modify the check to drop only samples with a negative delay.
This commit is contained in:
parent
c103bebd9f
commit
abb09418b1
1 changed files with 3 additions and 1 deletions
|
@ -705,9 +705,11 @@ get_phc_sample(int phc_fd, double precision, struct timespec *phc_ts,
|
|||
phc_tss[i] = ts2;
|
||||
delays[i] = UTI_DiffTimespecsToDouble(&ts3, &ts1);
|
||||
|
||||
if (delays[i] <= 0.0)
|
||||
if (delays[i] < 0.0) {
|
||||
/* Step in the middle of a PHC reading? */
|
||||
DEBUG_LOG("Bad PTP_SYS_OFFSET sample delay=%e", delays[i]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!i || delays[i] < min_delay)
|
||||
min_delay = delays[i];
|
||||
|
|
Loading…
Reference in a new issue