闰秒是什么?ntp如何处理闰秒?

1,了解闰秒是什么?

闰秒,是指为保持协调世界时接近于世界时时刻,由国际计量局统一规定在年底或年中(也可能在季末)对协调世界时增加或减少1的调整。由于地球自转的不均匀性和长期变慢性(主要由潮汐摩擦引起的),会使世界时(民用时)和原子时之间相差超过到±0.9秒时,就把协调世界时向前拨1秒(负闰秒,最后一分钟为59秒)或向后拨1秒(正闰秒,最后一分钟为61秒); 闰秒一般加在公历年末或公历六月末。
目前,全球已经进行了27次闰秒,均为正闰秒。
最近一次闰秒在北京时间2017年1月1日7时59分59秒(时钟显示07:59:60)出现。这也是本世纪的第五次闰秒。
 
对于闰秒的影响看业务自身的要求,一般大型应用服务器,需要实时处理数据的,都需要提前做好应对之策。
据我说了解的是阿里应对这第27次闰秒的措施是将这多出的1秒平均分摊到了24小时里。
http://www.siilu.com/20170105/209549.shtml
 
2,ntp如何处理闰秒呢?
redhat官方给出了5种处理闰秒的方法,下面这是ntp的处理方法,即使用-x选项。
With ntpd, the kernel backward step is used by default. With ntpd versions before 4.2.6, or 4.2.6 and later patched for this bug, the -x option (added to /etc/sysconfig/ntpd) can be used to disable the kernel leap second correction and ignore the leap second as far as the local clock is concerned. The one-second error gained after the leap second will be measured and corrected later by slewing in normal operation using NTP servers which already corrected their local clocks.
 
-x选项就是将NTP服务设置为 slew 模式
原理为: slew 模式并不使用step的阶段跳跃式修改时间。比如一次调整1秒。而是每秒调整 0.5ms 来缓慢修正时间。
 
关于闰秒的一些文章:
http://blog.csdn.net/syshzbtt/article/details/53751560
https://developers.redhat.com/blog/2015/06/01/five-different-ways-handle-leap-seconds-ntp/?utm_source=tuicool&utm_medium=referral
https://access.redhat.com/zh_CN/node/1422013#handling
 
3,ntp官网
http://www.ntp.org/
http://support.ntp.org/bin/view/Main/WebHome
 
原文地址:https://www.cnblogs.com/sonwnja/p/6780984.html