From: Miroslav Lichvar Date: Wed, 8 Jun 2022 13:30:05 +0000 (+0200) Subject: ntp: convert HW timestamp even if PHC reading fails X-Git-Tag: 4.3-pre1~32 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c23c0b84841e2710a8cd04746ef8cc3a0697903c;p=thirdparty%2Fchrony.git ntp: convert HW timestamp even if PHC reading fails Reading of PHC can fail occasionally on some hardware. If that happens, don't abort the conversion of the timestamp that triggered the reading. --- diff --git a/ntp_io_linux.c b/ntp_io_linux.c index 4d099cc9..acb41fa2 100644 --- a/ntp_io_linux.c +++ b/ntp_io_linux.c @@ -569,16 +569,15 @@ process_hw_timestamp(struct Interface *iface, struct timespec *hw_ts, double rx_correction, ts_delay, phc_err, local_err; if (HCL_NeedsNewSample(iface->clock, &local_ts->ts)) { - if (!SYS_Linux_GetPHCSample(iface->phc_fd, iface->phc_nocrossts, iface->precision, - &iface->phc_mode, &sample_phc_ts, &sample_sys_ts, - &phc_err)) - return; - - LCL_CookTime(&sample_sys_ts, &sample_local_ts, &local_err); - HCL_AccumulateSample(iface->clock, &sample_phc_ts, &sample_local_ts, - phc_err + local_err); - - update_interface_speed(iface); + if (SYS_Linux_GetPHCSample(iface->phc_fd, iface->phc_nocrossts, iface->precision, + &iface->phc_mode, &sample_phc_ts, &sample_sys_ts, + &phc_err)) { + LCL_CookTime(&sample_sys_ts, &sample_local_ts, &local_err); + HCL_AccumulateSample(iface->clock, &sample_phc_ts, &sample_local_ts, + phc_err + local_err); + + update_interface_speed(iface); + } } /* We need to transpose RX timestamps as hardware timestamps are normally