From: Miroslav Lichvar Date: Mon, 22 Nov 2021 14:52:01 +0000 (+0100) Subject: ntp: suppress monotonic timestamp if smoothing is enabled X-Git-Tag: 4.2-pre1~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8df49b799fb171a69f8d9a0fc036961cafc64559;p=thirdparty%2Fchrony.git ntp: suppress monotonic timestamp if smoothing is enabled Frequency transfer and time smoothing are conflicting features. Set the monotonic timestamp in the experimental extension field to zero (invalid) if time smoothing is activated. --- diff --git a/ntp_core.c b/ntp_core.c index cda4c9c9..fa2d5b25 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -974,7 +974,10 @@ add_ext_exp1(NTP_Packet *message, NTP_PacketInfo *info, struct timespec *rx, if (info->mode != MODE_CLIENT) { exp1.root_delay = UTI_DoubleToNtp32f28(root_delay); exp1.root_dispersion = UTI_DoubleToNtp32f28(root_dispersion); - UTI_AddDoubleToTimespec(rx, server_mono_offset, &mono_rx); + if (rx) + UTI_AddDoubleToTimespec(rx, server_mono_offset, &mono_rx); + else + UTI_ZeroTimespec(&mono_rx); UTI_GetNtp64Fuzz(&ts_fuzz, message->precision); UTI_TimespecToNtp64(&mono_rx, &exp1.mono_receive_ts, &ts_fuzz); exp1.mono_epoch = htonl(server_mono_epoch); @@ -1138,7 +1141,7 @@ transmit_packet(NTP_Mode my_mode, /* The mode this machine wants to be */ if (ext_field_flags) { if (ext_field_flags & NTP_EF_FLAG_EXP1) { - if (!add_ext_exp1(&message, &info, &local_receive, + if (!add_ext_exp1(&message, &info, smooth_time ? NULL : &local_receive, our_root_delay, our_root_dispersion)) return 0; }