A easy leap second, using Google’s public smear NTP service
Posted on December 5, 2016 • 2 minutes • 362 words • Suggest Changes
Isn’t it nice, not to waste time, on an issue you did not know you had until someone pointed out a solution ? Well that’s exactly what happened today. Seems on December 31, 2016 (its soon and its the worst possible time if you ask me) there is a leap second. Since our Earth has some unknown variables changing the rotation speed the time has to be adapted now and again. (quit at random it seems) Leap seconds cause all sorts of fun problems so unless you want to spend December 31 - January 1 behind a computer screen, better apply this leap-second cream to those chunky machines.
Engineer’s at Google came with a nice solution, some hours before or/and after they make the seconds the tiniest bit longer. The coolest part: you can use there expertise, when using there servers for ntp (network time protocol). Here’s how :
Install it if you did not use ntp before:
yum install ntp
At about line 20, /etc/ntp you should find :
# Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). server 0.centos.pool.ntp.org iburst server 1.centos.pool.ntp.org iburst server 2.centos.pool.ntp.org iburst server 3.centos.pool.ntp.org iburst
Comment, those 4 lines and add google’s
server time1.google.com iburst server time2.google.com iburst server time3.google.com iburst server time4.google.com iburst
resulting in :
# Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). #server 0.centos.pool.ntp.org iburst #server 1.centos.pool.ntp.org iburst #server 2.centos.pool.ntp.org iburst #server 3.centos.pool.ntp.org iburst server time1.google.com iburst server time2.google.com iburst server time3.google.com iburst server time4.google.com iburst
Restart the ntp service (or start)
service ntpd restart
Then validate if the servers have been added correctly. Using ntpq -p note that the results may vary. As long as its time[1-4].google.com
ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== *time1.google.co 71.79.79.71 2 u 36 64 3 95.522 -0.522 0.190 +time2.google.co 71.79.79.71 2 u 36 64 3 106.206 -0.371 0.052 +time3.google.co 71.79.79.71 2 u 36 64 3 4.824 -0.167 0.034 time4.google.co 71.79.79.71 2 u 36 64 3 256.651 0.917 0.049
hopefully this will ensure a happy new-year not a pager-duty new-year, we all know how that story ended :