alexcrichton / filetime

Accessing file timestamps in a platform-agnostic fashion in Rust
Apache License 2.0
122 stars 56 forks source link

Why is `11644473600` second subtracted in the `unix_second` fuction calculation? #76

Closed nsfoxer closed 2 years ago

nsfoxer commented 2 years ago

In the unix_seconds() function of the struct FileTime, it is calculated unix timestamp for 1970 year. When the system is Windows, the time difference from 1961 to 1970 needs to be subtracted. This value may be 3287 * 24 * 3600 = 283996800, not be 11644473600 ?

alexcrichton commented 2 years ago

I don't know myself at this point (it's been many years since I wrote this crate) and I probably ended up copying it from somewhere else. Is the crate producing the wrong results for you?

nsfoxer commented 2 years ago

Sorry, I have just tested on windows and Linux platforms and found that the value of 11644473600 is correct. Perhaps the starting point of timestamp under Windows does not start in 1961.