/* Special NTP reference IDs */
#define NTP_REFID_UNSYNC 0x0UL
#define NTP_REFID_LOCAL 0x7F7F0101UL /* 127.127.1.1 */
+#define NTP_REFID_SMOOTH 0x7F7F01FFUL /* 127.127.1.255 */
#endif /* GOT_NTP_H */
/* 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 &&
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 {
/* 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 */