mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 18:25:07 -05:00
ntp: use specific reference ID when smoothing served time
Set refid in server/broadcast packets to 127.127.1.255 when a time smoothing offset is applied to the timestamps. This allows the clients and administrators to detect that the server is not serving its best estimate of the true time.
This commit is contained in:
17
ntp_core.c
17
ntp_core.c
@@ -789,8 +789,8 @@ transmit_packet(NTP_Mode my_mode, /* The mode this machine wants to be */
|
||||
|
||||
/* Get current smoothing offset when sending packet to a client */
|
||||
if (SMT_IsEnabled() && (my_mode == MODE_SERVER || my_mode == MODE_BROADCAST)) {
|
||||
smooth_time = 1;
|
||||
smooth_offset = SMT_GetOffset(&local_transmit);
|
||||
smooth_time = fabs(smooth_offset) > LCL_GetSysPrecisionAsQuantum();
|
||||
|
||||
/* Suppress leap second when smoothing and slew mode are enabled */
|
||||
if (REF_GetLeapMode() == REF_LeapModeSlew &&
|
||||
@@ -801,6 +801,14 @@ transmit_packet(NTP_Mode my_mode, /* The mode this machine wants to be */
|
||||
smooth_offset = 0.0;
|
||||
}
|
||||
|
||||
if (smooth_time) {
|
||||
our_ref_id = NTP_REFID_SMOOTH;
|
||||
UTI_AddDoubleToTimeval(&our_ref_time, smooth_offset, &our_ref_time);
|
||||
UTI_AddDoubleToTimeval(local_rx, smooth_offset, &local_receive);
|
||||
} else {
|
||||
local_receive = *local_rx;
|
||||
}
|
||||
|
||||
if (are_we_synchronised) {
|
||||
leap = (int) leap_status;
|
||||
} else {
|
||||
@@ -828,13 +836,6 @@ transmit_packet(NTP_Mode my_mode, /* The mode this machine wants to be */
|
||||
|
||||
/* Now fill in timestamps */
|
||||
|
||||
if (smooth_time) {
|
||||
UTI_AddDoubleToTimeval(&our_ref_time, smooth_offset, &our_ref_time);
|
||||
UTI_AddDoubleToTimeval(local_rx, smooth_offset, &local_receive);
|
||||
} else {
|
||||
local_receive = *local_rx;
|
||||
}
|
||||
|
||||
UTI_TimevalToInt64(&our_ref_time, &message.reference_ts, 0);
|
||||
|
||||
/* Originate - this comes from the last packet the source sent us */
|
||||
|
||||
Reference in New Issue
Block a user