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

问题描述

为什么

考虑了时代时间

推荐答案

unix的早期版本系统时间间隔为1/60 s。这意味着32位无符号整数只能表示少于829天的时间范围。因此,必须在最近的一段时间内设置由数字 0 表示的时间(称为 epoch )。因为这是在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-32位的32位 signed 整数1-1作为其时代可以表示直到的日期。将环绕到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.

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

08-14 22:35