在今年, 2016 跨 2017 的時候多了一個閏秒,也就是 2016 年多了 1 秒,實際跨年倒數要再多一秒!這個對一般人來說是個不痛不養的 1 秒,但是對於技術人員來說,多這一秒可能會造成天下大亂,因為伺服器通常無法處理有61秒的一分鐘。
一般公司的內部 time server 就不說了,多數都是對外校時,但對於全球性的 time server 來說就不是這麼簡單了,從 leap smear 這邊看到在各大 time server 是如何處理 2017 年的閏秒
從圖中 Google 和 ntp1.sakura.ad.jp 都有計劃性的處理閏秒,左下角的 ntpd-4.2.8p9_leapsmearinterval,看起來是很想校時,但是似乎已經飄掉了,右下角的 ntl-time.colorado.edu 就 …. 讓他去吧,應該根本不知道有閏秒這回事?
Google 的作法是在 2016-12-31 14:00:00 UTC 到 2017-01-01 10:00:00 UTC 的 20 小時內將每秒慢 13.9 μs (毫秒) 來達到閏秒的校正
For the leap second #37, on December 31, 2016, we will use a 20-hour linear smear. The smear period will start at 2016-12-31 14:00:00 UTC and continue through 2017-01-01 10:00:00 UTC. Before and after this period, our clocks and time service will agree with servers that apply leap seconds.
During the smear, Google’s clocks will run slightly slower than usual. Each second of time marked by Google’s servers will be about 13.9 μs longer than an SI second. At the beginning of the leap second, smeared time will be just under 0.5 s behind UTC. UTC will insert an additional second while smeared time continues uninterrupted, causing smeared time to become just under 0.5 s ahead of UTC when the leap second ends.
AWS 和 Google 的作法很像,依循 2015 年閏秒的作法,也是調慢 24 小時內的每一秒
AWS Adjusted Time
This section provides specific details on how clocks will behave in the AWS Management Console and backend systems.Starting at 12:00:00 PM on June 30th, 2015, we will slow down AWS clocks by 1/86400. Every second on AWS clocks will take 1+1/86400 seconds of “real” time, until 12:00:00 PM on July 1st, 2015, when AWS clocks will be behind by a full second. Meanwhile, the standard civil time (UTC) will implement the leap second at the end of June 30th, 2015 and fall behind by a full second, too. Therefore, at 12:00:00 PM July 1st, 2015, AWS clocks will be synchronized to UTC again. The table below illustrates these changes.
從上面這些看到,知道 ntp server 校時要找誰校時了吧,否則自己的伺服器天下大亂了也不知道,找個負責任的 time server sync 是一件很重要的事情。