Leap second on June 30. How it affects Linux server environments?
This month we all have an extra second! A "leap second" will be added at midnight Coordinated Universal Time June 30. One-second adjustment is occasionally applied to UTC (Coordinated Universal Time) in order to keep its time of day close to mean solar time. Without this correction time defined by Earth's rotation goes away from atomic time because of irregularities in the Earth's rate of rotation. Leap seconds are added since 1972 and 25 such extra seconds have been inserted.
How Linux handles the leap second?
Server behavior during the Leap Second insertion depends on whether or not Linux system is running a NTP (Network Time Protocol) or PTP (Precision Time Protocol) service.
Systems running NTP service
Systems running NTP (Network Time Protocol) daemon should automatically account for leap second corrections. During the last day before a leap second correction, NTP servers should notify their clients that a leap second will occur, and at 23:59:59 UTC, the Linux kernel should add or remove an extra second by making the 60th second occur twice or removing it entirely.
Systems running PTP service
The timestamps exchanged in PTP are typically in TAI (International Atomic Time) which does not contain leap seconds; however, ptp4l and phc2sys will set the kernel flag to insert a leap second as the system clock continues to run in UTC. The kernel will then insert the leap second as normal.
Systems not using NTP or PTP
It is not recommended running without a time synchronization enabled. Without NTP or PTP enabled there is no guarantee that systems will remain in sync. Most probably time drift will occur on the server as determined by its internal clock.
Linux systems not using NTP or PTP to synchronize their time will not correct for leap seconds, and the time reported by these systems will have a one-second difference relative to UTC after the leap second correction. You should reset the clock manually after leap seconds occur.
The latest tzdata package also contains the leap second information. So you can configure your server to display time corrected for leap seconds by updating the tzdata package to the latest version available, copying the appropriate file from the /usr/share/zoneinfo/right directory hierarchy to /etc/localtime, and resetting the clock to the correct local time.
Various issues related to the leap second addition are possible. Application-specific issues may arise if the leap second was not considered during application development. It is recommended to test application on development environment to see how it behaves after the leap second is added.