未知的时间戳参考日期(Unknown timestamp reference date)

编程入门 行业动态 更新时间:2024-10-28 15:32:38
未知的时间戳参考日期(Unknown timestamp reference date)

我目前正在处理一个使用未知时间戳机制的系统。

系统在Windows机器上运行,所以我首先想到的是它使用某种Windows纪元作为其时间戳,但它似乎没有。

我的目标是将这些时间戳转换为Unix时间戳。


几个例子:

以下时间戳: 2111441659转换为: 2013-10-01 11:59

2111441998至2013-10-01 17:14 2111443876至2013-10-02 14:36 2111444089至2013-10-02 17:57

(所有日期均为GMT + 2)

我已经尝试使用上面的数据计算参考日期,但不知何故,我得到了每个时间戳的不同结果。

任何人都可以对这个相当奇怪的问题有所了解吗?

提前致谢!

I'm currently dealing with a system which uses an unknown timestamp mechanism.

The system is running on a Windows machine, so my first thought was that it uses some kind of Windows epoch for its timestamps, but it appears it does not.

My goal is to convert these timestamps to Unix timestamps.


A few examples:

The following timestamp: 2111441659 converts to: 2013-10-01 11:59

2111441998 to 2013-10-01 17:14 2111443876 to 2013-10-02 14:36 2111444089 to 2013-10-02 17:57

(All dates are GMT+2)

I've tried to calculate the reference date using the data above, but somehow I get a different result with every single timestamp.

Could anybody shed some light on this rather odd problem?

Thanks in advance!

最满意答案

对我来说,数字似乎很小,只有几毫秒。 我的第一个猜测是秒,但看着这个数字变化的速度,我认为分钟是一个更好的猜测。 做一些数学计算2111441659/60/24/365 = 4017.20254756这表明时代可能是在-2000年的某个时间?

这是计算中常见时代的列表,但是-2000年并不是真的存在:)你如何获得这个时间戳?

PS你确定这台机器的年份设定为2013年而不是4013吗? :)这将适合1年1月1日的.NET纪元

Finally, after many hours of comparing the timestamps with the datetimes, trying to discover the logic between them, I've found the answer by reverse engineering the software which generates the timestamps.

It turns out that the integer timestamps are actually bitwise representations* of the datetimes.

In pseudocode:

year = TimeStamp >> 20; month = (TimeStamp >> 16) & 15; day = (TimeStamp >> 11) & 31; hour = (TimeStamp >> 6) & 31; minute = TimeStamp & 63;

*I'm not sure if this is the correct term for it, if not, please correct me.

更多推荐

本文发布于:2023-07-30 07:08:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1336679.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:日期   时间   Unknown   date   reference

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!