Handling of Leap Seconds

Enhanced PTP User Guide (UG1602)

Document ID
UG1602
Release Date
2023-04-07
Revision
1.1 English

The timestamps in PTP messages received from a master clock are in TAI (atomic) timescale. When a PTP message is received, sfptpd will first convert the atomic timestamp to a UTC timestamp for comparison with the internal UTC clock time. When a positive leap second is inserted in the UTC timescale, an additional second is inserted which effectively causes the UTC time to step backwards by one second. Following the leap second the UTC offset, currently 37 seconds, becomes 38 seconds.

UTC time =(TAI time - UTC offset)

The action applied when a leap second occurs will depend on the sfptpd clock_control configuration option enabled in the sfptpd configuration file.

The clock_control option determines the step/slew action applied to the Local Reference Clock (LRC) at all times, including when a leap second occurs. (The LRC is the clock that is currently being disciplined by sfptpd.)

sfptpd is able to slew the clock at a maximum rate of 1 million ppb (1 part in a 1000) so slewing will take approximately 20 minutes to recover 1 second. The slew rate is not configurable.

Corrective action is applied to the LRC. Other clocks in the server will be synchronized with the LRC.

Table 1. Leap Second Action
Clock_control Option Leap Second Action
slew-and-step Default. Suspend clock synchronization, step the clock currently being disciplined backwards by one second and then recommence normal synchronization when the next announce message is received.
step-at-startup Slew the clock to correct for leap second insertion.
no-step Slew the clock to correct for leap second insertion.
no-adjust Do not adjust clock.
step-forward Will not step the clock when a positive leap second occurs, but will slew the clock to correct for leap second insertion.
step-on-first-lock Slew the clock to correct for leap second insertion.