]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
ntp: fix time smoothing in interleaved mode
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 20 Jan 2017 12:17:45 +0000 (13:17 +0100)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 23 Jan 2017 14:58:55 +0000 (15:58 +0100)
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.

ntp_core.c

index 48ae3d1a19246beff6885e4f01d307548070f849..014f999d7e2b9b4172179c644355e0ad9de6788d 100644 (file)
@@ -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);