码迷,mamicode.com
首页 > 其他好文 > 详细

科普一下:Y2K千年虫问题

时间:2015-04-26 16:29:47      阅读:378      评论:0      收藏:0      [点我收藏+]

标签:

这周没有给定的博客主题,我就来科普科普在复习过程中遇到的感兴趣的问题吧~

Year 2000 problem(千年虫问题)

The Year 2000 problem (also known as the Y2K problem, the Millennium bug, the Y2K bug, or simply Y2K) was a problem for both digital (computer-related) and non-digital documentation and data storage situations which resulted from the practice of abbreviating a four-digit year to two digits.

【千年虫的来历】

  两千年问题始于1960年代,当时计算机内存和外部存储介质的成本很高,大多数数据处理需要借助于用穿孔卡片,它用80行文本表示所储存的数据。为了节省硬件成本,葛丽丝·霍普在Harvard Mark I上,以6位数字来存储时间,即年、月、日各两位。这个习惯被COBOL继承下来,传播到整个计算机程序界。

  那个时候的编程语言,如COBOL和RPG,使用ASCII码和EBCDIC编码表示数据。如果用四位数字表示年份,就要多占用储存器空间,就会使成本增加,因此为了节省存储空间,计算机系统的编程人员采用两位数字表示年份,随着计算机技术的迅猛发展,虽然后来存储器的价格降低了,但在计算机系统中使用两位数字来表示年份的做法却由于思维上的惯性势力而被沿袭下来。对大多数程序员来讲,他们并不认为所编写的软件会持续使用很多年。

  比较有意思的是,两千年问题是由Bob Bemer在1958年第一次提出的。在其后的二十年里,他用了很大的努力,希望政府、企业和国际组织(如IBM和ISO)来关注这个问题,但反响寥寥。直到2000年将要到来的时候,人们才感觉到两千年问题的紧迫性。于是社会和政府都投入了大量的人力和物力来避免发生大规模的计算机灾难。而从现在来看,这些努力也获取了相应的成果。

【几个典型的Y2K时间】

  • 1999年1月1日
  • 1999年4月9日(1999年的第99日)
  • 1999年9月9日
  • 1999年12月31日
  • 2000年1月1日
  • 2000年2月28日
  • 2000年2月29日
  • 2099年1月1日
  • 2099年4月9日
  • 2099年9月9日
  • 2099年12月31日
  • 2111年11月11日

9 September 1999

Even before 1 January 2000 arrived, there were also some worries about 9 September 1999 (albeit less than those generated by Y2K). Because this date could also be written in the numeric format 9/9/99, it could have conflicted with the date value 9999, frequently used to specify an unknown date. It was thus possible that database programs might act on the records containing unknown dates on that day. Data-entry operators commonly entered 9999, into required-fields for an unknown future-date, (e.g. a termination date for cable-television or telephone service), in order to process computer forms using CICS software. Somewhat similar to this is the end-of-file code 9999, used in older programming languages. While fears arose that some programs might unexpectedly terminate on that date, the bug was more likely to confuse computer operators than machines.

Year 2038 problem

Main article: Year 2038 problem

The original Unix time datatype (time_t) stores a date and time as a signed long integer (on 32 bit systems a 32-bit integer) representing the number of seconds since 1 January 1970. During and after 2038, this number will exceed 231 − 1, the largest number representable by a signed long integer on 32 bit systems, causing the Year 2038 problem (also known as the Unix Millennium bug or Y2K38). As a long integer in 64 bit systems uses 64 bits, the problem does not exist on 64 bit systems that use the LP64 model.

=======================================================

总的来说,千年虫问题起源于最开始的程序设计过程中对时间表示的疏忽,酝酿出了如今这一庞大的问题。也许这在当年看来不过是一个不能再简单的问题,是一个小小的程序,却对全世界造成了不可思议的影响。看来,程序员真的是有改变世界的潜质!没准身边的谁谁谁正在悄悄的影响着整个世界呢~哈哈~滚回去复习啦~

附:阅读资料来源:维基百科Wikipedia http://en.wikipedia.org/wiki/Year_2000_problem

科普一下:Y2K千年虫问题

标签:

原文地址:http://www.cnblogs.com/ccvamy/p/4457773.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!