Why do timestamps have a limit to 2038?(为什么时间戳限制为 2038?)
问题描述
我刚刚在运行日历脚本时发现,PHP 中的时间戳限制为 2038.这到底是什么意思?为什么是 2038 而不是 2050 或 2039?如果时间戳只计算给定日期(1970 年)的秒数,为什么要限制?
I just found out, running a calendar script, that timestamps in PHP has a limit to 2038. What does it really mean? Why is it 2038 instead of 2050 or 2039? Why a limit if timestamps just count seconds from a given date (1970)?
推荐答案
限制是由大多数 C 库用于表示该计数的 4 字节有符号整数强加的.快速数学(假设 365 天年,不完全正确):
The limit is imposed by the 4 byte signed integers that most C libraries use for representing that count. Quick math (assumes 365 day years, not exactly correct):
2147483648 seconds ~ 68.1 years
这也意味着下限约为 1900.一些库已经开始引入 64 位 epoch 计数,但目前还很少.
This also implies a lower limit of ~1900. Some libraries have started to introduce 64 bit epoch counts, but they are few and far between for the moment.
这篇关于为什么时间戳限制为 2038?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么时间戳限制为 2038?


基础教程推荐
- Libpuzzle 索引数百万张图片? 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01