本文介绍了为什么 1/1/1970 是“大纪元时间"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么

1970 年 1 月 1 日 00:00:00

考虑过纪元时间?

推荐答案

早期版本的 unix 以 1/60 秒的间隔测量系统时间.这意味着 32 位无符号整数只能表示小于 829 天的时间跨度.因此,由数字 0(称为 纪元)表示的时间必须设置在最近的过去.由于这是在 1970 年代初期,因此纪元设置为 1971-1-1.

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.

后来,系统时间改为每秒递增,这将可以用32位无符号整数表示的时间跨度增加到136年左右.由于从计数器中挤出每一秒不再那么重要,纪元被四舍五入到最接近的十年,从而成为 1970-1-1.必须假设这被认为比 1971-1-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.

请注意,使用 1970-1-1 作为其纪元的 32 位有符号整数可以表示直到 2038-1-19,在该日期它将环绕到 1901-12-13.

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.

这篇关于为什么 1/1/1970 是“大纪元时间"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 19:41