2038年的“千年虫”

想必大家对电脑的“千年虫”问题还记忆犹新,那个由于简便的双位时间表示法(即mm/dd/yy)而酿成的危机,造成上世纪末时很多程序时间表示法的重新设置(重新定义00、01、02等等,或者改为yyyy表示年)。

在当时的那场风暴中,Unix/Linux用户没有受到影响,因为在这些系统中,时间的表示方法是把1970年1月1日中午12点(January 1, 1970, at 12:00:00 a.m)设置为时间原点“0”,每增加1秒,就是一个新的时间,真实的时间就是用原点时间加上增加的时间就对了。比如系统运算的时间是60,那么真实的时间就是1970年1月1日11分。

正是由于这种时间算法的不同,帮助*Unix用户没有受到千年虫的威胁。但是也正是由于这种算法,它将面临一个另一个虫虫。

*nix系统储存新增的时间使用的是4bytes(32-bit)表示法,其新增时间的区间是0——2,147,483,647。如果超过了 2,147,483,647,系统时间又要自动回零,造成像千年虫一样的后果。这个自时间原点增加了2,147,483,647秒之后的时间是2038年1月19日。到了那一天所有的*nix系统的电脑都会碰到时间回零的问题。(关于2,147,483,647这个数是怎么算出来的,可以参考这篇文章。)

Y2k38提出了这个问题,并且在网站顶端设置了倒计时器,见上图。(此链接国内需代理)

对于任何系统来说,都会存在因时间设置出现的虫的问题,比如,IBM品牌的电脑将在2116年迎来它自己的虫子,视窗NT的虫子在2184年到来,Mac系统的虫子据说要到29940年才会到来。

经过了千年虫的恐慌,地球人都应该有经验了,我们还有足够的时间,而且现在存储成本很低,把时间存储格式改到更大就可以挽救所谓的2038危机了。

了解更多相关内容,请参考Howstuffworks

The world ends on January 19, 2038: thanks Unix!

(Via Download Squad) According to Y2K38.info, Unix keeps track of the date and time using a four byte integer that represents the number of seconds past January 1, 1970. The integer can only get so big before having to restart from zero. If a machine can’t restart it’s time, which may be the case for many Unix systems, it will crash. Hackosis confirms this problem has the potential to affect Linux boxes too. Unfortunately, machines running on *nix operating systems act as the backbone for much of the cyber-world, meaning we may see anything from planes falling out of the sky to the internet shutting down when this hits.Read more.

Want to know more? Please check what Howstuffworks says.

相关文章

Discussion Area - Leave a Comment




  • Partner links