且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将刻度转换为Unix时间戳

更新时间:2023-01-22 12:19:15

C#ticks是自午夜0001-01-01 00:00:00开始的滴答数(每个滴答是1/10000000秒),而UNIX timestamp是自开始以来的秒数. UNIX时代(1970-01-01 01:00:00),因此所需的结果是$seconds = 634942626000000000/10000000 - $number_of_seconds,其中$number_of_seconds0001-00-01 00:00:001970-01-01 01:00:00之间的秒数.因此,您现在所要做的就是确定$number_of_seconds等于什么.

C# ticks is a number of ticks since midnight 0001-01-01 00:00:00 (every tick is 1/10000000 of second) and UNIX timestamp is number of seconds since beginning of the UNIX epoch (1970-01-01 01:00:00), so desired result is $seconds = 634942626000000000/10000000 - $number_of_seconds, where $number_of_seconds is seconds between 0001-00-01 00:00:00 and 1970-01-01 01:00:00. So, all you need now is to determine what $number_of_seconds is equals.

更新:这是在C#中的操作方法:

Update: this is how to do it in C# : How to convert a Unix timestamp to DateTime and vice versa?

更新2 使用此简单脚本 http://hastebin.com/lefiyiheju. mel 确定$number_of_seconds是62136892800,但我不知道它是否准确

Update 2 Using this simple script http://hastebin.com/lefiyiheju.mel determined that $number_of_seconds is 62136892800, but I don't know if it is much accurate