简体   繁体   English

UNIX时间太长

[英]UNIX time is too long

I've got this number 13008365973607952 and I know that it corresponds to Thursday, 21 March 2013 19:59:33 . 我已经有了这个号码13008365973607952 ,我知道它对应于2013年3月21日星期四19:59:33 However, for me this number seems too long. 但是,对我来说,这个数字似乎太长了。 When I use Python's time.time() function I get only 1363901872.498432 , which is as long as mention before if you drop the dot, but then it becomes too big (value). 当我使用Python的time.time()函数时,我只会得到1363901872.498432 ,这与前面提到的一样长(如果您删除点),但是它变得太大(值)。

Can anyone tell me how to get such a valid number? 谁能告诉我如何获得这样的有效号码?

secsAfterADEpoch = float(your_weird_time) / 10000000.0 # seconds since jan 1st 1601
ADToUnixConvertor = ((1970-1601) * 365.242190) * 86400 # unix epoch - AD epoch * number of tropical days * seconds in a day
unixified = (secsAfterADEpoch-ADToUnixConvertor)+31800 # unix Timestamp version of AD timestamp + correction time

Erm try this? 嗯试试这个吗?

Note: +31800 was something i had to add to the equation most likely to my timezone or some mathematical issue in the previous calculations.. so if your's doesn't work keep in mind i'm +1 GMT (or CET) so removing it or changing it accordingly might be a good idea if you get close results but not spot on :) 注意: +31800是我必须添加到方程中最有可能是我的时区或以前的计算中的一些数学问题的东西..因此,如果您不起作用,请记住我是+1 GMT(或CET),因此删除如果您获得接近的结果但没有发现:)或相应地更改它可能是个好主意。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM