为什么 chrome 浏览器的时间戳是从 1601-01-01 0:0:0 开始纪元的呢?

2019-04-12 18:05:13 +08:00
 tuding
The current WebKit timestamp is 13199537040000000
为什么要用这么奇葩的时间戳? 是有什么原因吗?
2658 次点击
所在节点    程序员
7 条回复
creanme
2019-04-12 18:08:35 +08:00
chrome 是从电脑本地获取的时间,这边有说明为什么
https://stackoverflow.com/questions/10849717/what-is-the-significance-of-january-1-1601
geelaw
2019-04-12 18:10:52 +08:00
这个是 Win32 epoch。因为 Gregorian Calendar 的周期是 400 年,这个时间是 Windows NT 开发的时候的最近的周期开始点。这样选择可以让一些数学更简单。

https://devblogs.microsoft.com/oldnewthing/20090306-00/?p=18913
tuding
2019-04-12 18:13:41 +08:00
@creanme #1
@geelaw #2
原来如此
halk
2019-04-12 18:13:56 +08:00
Here ’ s a few examples of this madness:

NTFS  —  The number of 100ns intervals since January 1, 1601, 12:00:00 AM UTC.
HFS+ —  The number of seconds since January 1, 1904 12:00:00 AM UTC.
Mac “ Absolute Time ” —  The number of seconds since January 1, 2001, 12:00:00 AM UTC.
Epoch/Unix/POSIX  —  The number of seconds since January 1, 1970, 12:00:00 AM UTC.
Chrome/Webkit  —  The number of milliseconds since January 1, 1601, 12:00:00 AM UTC.
saluton
2019-04-12 18:39:49 +08:00
我感觉跟 1582 年历法改革有关(我还没看一二楼
ysc3839
2019-04-12 19:10:44 +08:00
@creanme @geelaw @halk
想问下非 Windows 系统的 WebKit 也是使用这种 timestamp 吗?如果是的话又是为什么呢?也是为了方便计算?
creanme
2019-04-12 21:04:45 +08:00
@ysc3839 没在非 windows 上用过 webkit (逃

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/554569

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX