From: Miroslav Lichvar Date: Fri, 20 Jan 2017 12:17:45 +0000 (+0100) Subject: ntp: fix time smoothing in interleaved mode X-Git-Tag: 3.1-pre1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da2d33e9a84baa7325503440099dd8f1e567cdd4;p=thirdparty%2Fchrony.git ntp: fix time smoothing in interleaved mode When the server's transmit timestamp was updated with a kernel/HW timestamp, it didn't include the time smoothing offset. If the offset was larger than one second, the update failed and clients using the interleaved mode received less accurate timestamps. If the update succeeded, the clients received timestamps that were not adjusted for the time smoothing offset, which added an error of up to 0.5s/1s to their measured offset/delay. Fix the update to include the smoothing offset in the new timestamp. --- diff --git a/ntp_core.c b/ntp_core.c index 48ae3d1a..014f999d 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -2036,6 +2036,9 @@ NCR_ProcessTxUnknown(NTP_Remote_Address *remote_addr, NTP_Local_Address *local_a if (log_index < 0) return; + if (SMT_IsEnabled() && NTP_LVM_TO_MODE(message->lvm) == MODE_SERVER) + UTI_AddDoubleToTimespec(&tx_ts->ts, SMT_GetOffset(&tx_ts->ts), &tx_ts->ts); + CLG_GetNtpTimestamps(log_index, &local_ntp_rx, &local_ntp_tx); UTI_Ntp64ToTimespec(local_ntp_tx, &local_tx.ts);