ntp: smear leap second with slewing mode and smoothing
Suppress leap second in packets sent to clients when smoothing and leap second slew mode are enabled.
This commit is contained in:
parent
293806d52d
commit
ba85544611
3 changed files with 16 additions and 0 deletions
|
@ -786,6 +786,11 @@ transmit_packet(NTP_Mode my_mode, /* The mode this machine wants to be */
|
||||||
if (SMT_IsEnabled() && (my_mode == MODE_SERVER || my_mode == MODE_BROADCAST)) {
|
if (SMT_IsEnabled() && (my_mode == MODE_SERVER || my_mode == MODE_BROADCAST)) {
|
||||||
smooth_time = 1;
|
smooth_time = 1;
|
||||||
smooth_offset = SMT_GetOffset(&local_transmit);
|
smooth_offset = SMT_GetOffset(&local_transmit);
|
||||||
|
|
||||||
|
/* Suppress leap second when smoothing and slew mode are enabled */
|
||||||
|
if (REF_GetLeapMode() == REF_LeapModeSlew &&
|
||||||
|
(leap_status == LEAP_InsertSecond || leap_status == LEAP_DeleteSecond))
|
||||||
|
leap_status = LEAP_Normal;
|
||||||
} else {
|
} else {
|
||||||
smooth_time = 0;
|
smooth_time = 0;
|
||||||
smooth_offset = 0.0;
|
smooth_offset = 0.0;
|
||||||
|
|
|
@ -328,6 +328,14 @@ REF_SetModeEndHandler(REF_ModeEndHandler handler)
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
|
REF_LeapMode
|
||||||
|
REF_GetLeapMode(void)
|
||||||
|
{
|
||||||
|
return leap_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================================================== */
|
||||||
|
|
||||||
static double
|
static double
|
||||||
Sqr(double x)
|
Sqr(double x)
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,6 +69,9 @@ typedef void (*REF_ModeEndHandler)(int result);
|
||||||
/* Set the handler for being notified of mode ending */
|
/* Set the handler for being notified of mode ending */
|
||||||
extern void REF_SetModeEndHandler(REF_ModeEndHandler handler);
|
extern void REF_SetModeEndHandler(REF_ModeEndHandler handler);
|
||||||
|
|
||||||
|
/* Get leap second handling mode */
|
||||||
|
extern REF_LeapMode REF_GetLeapMode(void);
|
||||||
|
|
||||||
/* Function which takes a local cooked time and returns the estimated
|
/* Function which takes a local cooked time and returns the estimated
|
||||||
time of the reference. It also returns the other parameters
|
time of the reference. It also returns the other parameters
|
||||||
required for forming the outgoing NTP packet.
|
required for forming the outgoing NTP packet.
|
||||||
|
|
Loading…
Reference in a new issue