为什么1/1/1970是“纪元时间”?

[英]Why is 1/1/1970 the “epoch time”?


Why is

为什么

1 January 1970 00:00:00

1970年1月1日就是

considered the epoch time?

认为时代的时间吗?

4 个解决方案

#1


370  

Early versions of unix measured system time in 1/60 s intervals. This meant that a 32-bit unsigned integer could only represent a span of time less than 829 days. For this reason, the time represented by the number 0 (called the epoch) had to be set in the very recent past. As this was in the early 1970s, the epoch was set to 1971-1-1.

unix的早期版本以1/60秒的间隔测量系统时间。这意味着一个32位无符号整数只能表示小于829天的时间跨度。由于这个原因,以数字0(称为纪元)表示的时间必须在最近的过去被设定。就像上世纪70年代初那样,时代被设定为1971-1。

Later, the system time was changed to increment every second, which increased the span of time that could be represented by a 32-bit unsigned integer to around 136 years. As it was no longer so important to squeeze every second out of the counter, the epoch was rounded down to the nearest decade, thus becoming 1970-1-1. One must assume that this was considered a bit neater than 1971-1-1.

后来,系统时间被更改为每秒递增一次,这将32位无符号整数表示的时间跨度增加到大约136年。由于从柜台上挤出每一秒已不再那么重要,时代被缩小到最近的十年,从而成为1970年至1971年。我们必须假设,这被认为比1971-1更整洁。

Note that a 32-bit signed integer using 1970-1-1 as its epoch can represent dates up to 2038-1-19, on which date it will wrap around to 1901-12-13.

注意,一个32位的带符号整数,使用1970-1-1作为它的纪元,可以表示日期为2038-1-19,在这个日期,它将会绕到1901-12-13。

#2


43  

History.

历史。

The earliest versions of Unix time had a 32-bit integer incrementing at a rate of 60 Hz, which was the rate of the system clock on the hardware of the early Unix systems. The value 60 Hz still appears in some software interfaces as a result. The epoch also differed from the current value. The first edition Unix Programmer's Manual dated November 3, 1971 defines the Unix time as "the time since 00:00:00, Jan. 1, 1971, measured in sixtieths of a second".

Unix最早的版本是32位整数,以60赫兹的速率递增,这是早期Unix系统硬件上系统时钟的速率。因此,值60 Hz仍然出现在一些软件界面中。时代也不同于当前的价值。1971年11月3日的第一版Unix程序员手册将Unix时间定义为“1971年1月1日00:00时以来的时间,以0 / 6秒为单位”。

#3


7  

http://en.wikipedia.org/wiki/Unix_time#History explains a little about the origins of Unix time and the chosen epoch. The definition of unix time and the epoch date went through a couple of changes before stabilizing on what it is now.

http://en.wikipedia.org/wiki/Unix_time#历史解释了一些关于Unix时间的起源和所选择的纪元。unix时间和历元日期的定义在稳定之前经历了一些变化。

But it does not say why exactly 1/1/1970 was chosen in the end.

但是它并没有说为什么最后选择了1/1/1970。

Notable excerpts from the Wikipedia page:

维基百科页面的一些值得注意的摘录:

The first edition Unix Programmer's Manual dated November 3, 1971 defines the Unix time as "the time since 00:00:00, Jan. 1, 1971, measured in sixtieths of a second".

1971年11月3日的第一版Unix程序员手册将Unix时间定义为“1971年1月1日00:00时以来的时间,以0 / 6秒为单位”。

Because of [the] limited range, the epoch was redefined more than once, before the rate was changed to 1 Hz and the epoch was set to its present value.

由于[]范围有限,在利率变为1 Hz并将epoch设为其现值之前,对epoch进行了多次重新定义。

Several later problems, including the complexity of the present definition, result from Unix time having been defined gradually by usage rather than fully defined to start with.

后来出现的几个问题,包括当前定义的复杂性,都是由Unix时间逐渐定义的,而不是完全定义的。

#4


-7  

Short answer: Why not?

简短的回答:为什么不呢?

Longer answer: The time itself doesn't really matter, as long as everyone who uses it agrees on its value. As 1/1/70 has been in use for so long, using it will make you code as understandable as possible for as many people as possible.

更长的回答:时间本身并不重要,只要每个使用它的人都认同它的价值。由于1/70已经使用了很长时间,使用它将使您尽可能多地理解代码。

There's no great merit in choosing an arbitrary epoch just to be different.

选择一个任意的时代只是为了与众不同,这并没有什么大的好处。

智能推荐

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.itdaan.com/blog/2011/06/23/720208272bd85437eb61a670b48e5d6.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告