You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
windows: fix filetime conversions and deprecate Nanoseconds
Filetime.Nanoseconds() has a major drawback: the returned int64 is too
small to represent Filetime's zero value (January 1, 1601) in terms of
nanoseconds since Epoch (00:00:00 UTC, January 1, 1970); MinInt64 only dates
back to year 1677.
This has real-life implications, e.g., some Windows sub systems
(Perflib, to name one) create registry keys with the last write time
property set to zero. In this case, ModTime() reports an
underflow-affected value of 2185-07-22T00:34:33.709551+01:00.
This commit deprecates Nanoseconds() in favor of the new Unix() that
returns a well-known pair of seconds and nanoseconds thus is capable to
cover the full range of Filetime values. ModTime() uses Unix()
accordingly to produce correct time.Time values again. Additionally,
ModTimeZero() provides a convenient way to check for a last write
time value of zero in analogy to time.Time.IsZero(); no need to specify
January 1, 1601 manually.
0 commit comments