By Andreja Jarc.
The timing industry is anxiously waiting for the unavoidable Leap Second Insertion which is announced for this year on June 30, 2015 at UTC midnight. The Leap Second has been introduced by The International Earth Rotation Service (IERS) in order to keep up the relationship between the UTC time and the Earth rotation. Since launching of the UTC time in the 1970’s, 16 leap seconds have been inserted until now, and the 17th is added at the end of June.
The leap second is seen as an unpleasant discontinuity in the global time scale as it causes an abrupt time jump which may provoke a lot of confusion for the synchronized systems. Just imagine high speed trading algorithms where each nanosecond difference is crucial to decide between high profits or loss. And if a leap second appears within a trading day (e.g. UTC midnight + 9 hrs local time), this particular additional second may be worth millions…
Anyway, it is important to be prepared. One of the approaches is to simulate the leap second event in your testing environment and to check how different devices handle the event. In this blog post I will introduce you to the Meinberg PROTOSIM Simulation Software which can help to simulate a leap second in NTP and PTP networks.
Let us walk together through a possible test scenario. In MBGPROTOSIM we will simulate an NTP server with a Leap Second insertion on June 30, 2015 after 23:59:59 UTC time and check how an NTP client handles the insertion.
After starting the MBGPROTOSIM tool, you can configure a new NTP-Server in two steps as shown on the following figures 1 and 2.
Figure 1: To perform a Leap Second test, enable the Date Simulation and Leap Second Simulation in the first page of the “Add Group” configuration dialogue and set the start time of the simulation to June 30, 2015, shortly before midnight.
Figure 2: Set the correct NTP parameters at Step 2 for the simulated NTP Server. For this test, the settings as shown above will do the right job for you.
Start the Simulation by pressing the “Run Simulation” button. Since the simulation is now running this particular icon is faded out in the screenshot below.
Figure 3: Simulated NTP server with the upcoming Leap Second insertion. In the NTP Logs you can check if requests and responses between (real) NTP clients and the simulated server have been successfully exchanged.
Now we have to check what is happening on the NTP client. For this test I used a Win 8.1 laptop with running ntp 4.2.8p1 version. With the NTP Monitor tool for Windows from Meinberg I see the following NTP status:
Figure 4: NTP Client sync to the simulated NTP server with the correct refid and other parameters as configured in MBGPROTOSIM.
Please note that the Windows client will actually set its date to June 30, 2015. If you later reset the clock to the correct date, any files and timestamps that have been created during the tests will be in the future. This can cause problems with a lot of programs like eMail clients (recording the arrival date/time of mail messages), databases (using timestamps to indicate changed data records) and so on.
I therefore strongly recommend to not use a client system that has important or useful data on it . If that is not possible, quit all other programs and stop all services not required for this test and avoid creating / modifying files during the period in which your test system is synchronized to the simulated server. As always, creating a back up is a good idea and crucial to avoid data loss.
I check now the NTP timing sequence between a client and the server in Wireshark (a helpful network analyzing tool, you can get it for free from Wireshark).
Figure 5: NTP packets exchange between a client and server a few minutes prior the Leap Second event. Please note that the LS indicator flag is correctly set to 01. This is an announcement bit which activates the Leap Second handling in ntpd on the client when a Leap Second is inserted.
After the fact you can check whether the client correctly inserted the leap second. Just a quick check from the Event Viewer perspective:
Figure 6: We see here that a positive leap second has been successfully inserted in the client.
Let us check the content of the NTP packets again. Is there any difference in the packet sequence between a client and server?
Figure 7: As you can notice, the LS Flag is now set back to normal “00” which implies that no Leap Second is announced.
This is one of the possible tests to see how an NTP client handles the announced Leap Second event. To learn about the Leap Second and its handling in various time transfer protocols like NTP, PTP, IRIG etc., join us at the upcoming Leap Second Workshop organized by the Meinberg Sync Academy. The Theory and extensive hands-on testing – including scenarios using various OS (Linux and Windows) client and server implementations – will be provided by experienced NTP and Leap Second experts.
This is a great opportunity to prepare yourself and your network for this year’s Leap Second and learn fundamentals that help you and your colleagues to avoid problems caused by this planned time discontinuity.
For any further questions feel free to contact me at andreja.jarc[at]meinberg.de or check our Meinberg Web Page at: www.meinbergglobal.com.
If you enjoyed this post, or have any questions left, feel free to leave a comment or question below.