為什么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.

選擇一個任意的時代只是為了與眾不同,這並沒有什么大的好處。


注意!

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



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