## 闰秒 | Leap seconds 刷微博时看到[@蚁工厂|weibo](http://weibo.com/antvision)呼吁各运维为linux服务器+1s。 否则会导致一些低版本的linux服务器在执行ntp服务时异常而cpu占用100%。 科普自己: [2017年“标准时间”闰秒:让奔跑的秒针喘口气](http://cnews.chinadaily.com.cn/2017-01/01/content_27834270.htm) ### 世界时 地球钟,也就是世界时。是根据地球自转来确定的,地球自转一圈就是一天,一天就是24小时,也就是86400秒,“然而,由于地球自转并不均匀,有时快有时慢,就会造成走时误差。” 董绍武介绍,目前世界时来自国际地球自转服务中心IERS网站发布的结果,全球有世界时联测网。 ### 原子时 原子钟,也就是原子时。“原子时是利用原子振荡频率确定的时间尺度,非常稳定。”董绍武介绍,1967年,第十三届国际计量大会正式把由铯原子钟确定的原子时定义为国际时间标准,取代了天文学的秒长的定义,“准确来说,位于海平面上的铯133原子基态的两个超精细能级间在零磁场中跃迁震荡9192631770个周期所持续的时间为一个原子时秒。” ### 世界协调时 现在全球用的标准时间是“协调世界时”,“所谓协调世界时,是采用原子时的秒长,在时刻上与世界时时刻之差保持在正负0.9秒之内,必要时用阶跃1整秒的方式,就是所谓的闰秒来调整。”因此,协调世界时既不是原子时,也不是世界时,而是两者的结合和协调。 2016年7月6日,巴黎国际地球自转服务组织向全球负责标准时间测量和发播的机构发布最新一次闰秒公告:协调世界时将在2017年1月1日实施一个正闰秒,也就是增加1秒,由于时差的原因,我国将在北京时间2017年1月1日的7时59分59秒和全球同步进行闰秒调整,届时会出现7:59:60的特殊现象。 ## 计算机时间系统Bug 关于计算机时间系统还有两个著名bug,Y2K千年虫与2038年问题,并且都是由integer overflow(整形溢出)导致的。 ### Y2K | 千年虫 | Year 2000 problem Wiki:The Year 2000 problem is also known as the Y2K problem, the Millennium bug, the Y2K bug, or Y2K. Problems arose because programmers represented the four-digit year with only the final two digits. This made the year 2000 indistinguishable from 1900. The assumption that a twentieth-century date was always understood caused various errors, such as the incorrect display of dates, and the inaccurate ordering of automated dated records or real-time events. [@苏莉安 | zhihu](https://www.zhihu.com/question/20224097/answer/18439302) “真的,非常非常严重。当年证券、银行、军事、电力、通信、医疗等行业都已经大规模应用计算机。应用得越早、对信息化依赖程度越高,出现千年虫的可能性就越大(因为早期的程序都是用的两位数年份)、越难于修改(早期的系统和软件通用性不高,甚至有固化在芯片内部的程序),危害就更不用说了,这些个个都是关乎国计民生的大事,一旦出错后果不堪设想。" ### Year 2038 problem | Unix Millennium Bug Wiki:The latest time that can be represented in Unix's signed 32-bit integer time format is 03:14:07 UTC on Tuesday, 19 January 2038 (2,147,483,647 seconds after 1 January 1970).[2] Times beyond that will wrap around and be stored internally as a negative number, which these systems will interpret as having occurred on 13 December 1901 rather than 19 January 2038. This is caused by integer overflow. The counter runs out of usable digit bits, flips the sign bit instead, and reports a maximally negative number (continuing to count up, toward zero). Resulting erroneous calculations on such systems are likely to cause problems for users and other relying parties. ![Year 2038 problem animation](https://upload.wikimedia.org/wikipedia/commons/e/e9/Year_2038_problem.gif)