Proposal Details
#74335 reported that time.Unix(0, syscall.Filetime{0, 0}.Nanoseconds()) returns incorrect time in golang.org/x/sys/windows/registry package.
The same problem is present for all syscall.Filetime values that correspond to time between "January 1, 1601 (corresponds to syscall.Filetime{0, 0})" and "January 1, 1970".
CL 682816 fixed the problem in one single place where we use time.Unix(0, syscall.Filetime{...}.Nanoseconds()) by implementing the logic locally, but there are others.
@rsc suggested we add new method
// Unix returns the local Time in sec seconds
// and nsec nanoseconds since January 1, 1601 UTC.
// It is valid to pass the function result
// to time.Unix to convert Filetime ft into time.Time.
func (ft *Filetime) Unix() (sec, nsec int64)
in syscall and golang.org/x/sys/windows packages so new method can be used as
time.Unix(syscall.Filetime{...}.Unix())
I created CL 758981 that contains the proposed change for syscall package as an example.
CC @golang/windows and @gremat (who did all the work in #74335 and CL 682816)
Proposal Details
#74335 reported that
time.Unix(0, syscall.Filetime{0, 0}.Nanoseconds())returns incorrect time ingolang.org/x/sys/windows/registrypackage.The same problem is present for all
syscall.Filetimevalues that correspond to time between "January 1, 1601 (corresponds to syscall.Filetime{0, 0})" and "January 1, 1970".CL 682816 fixed the problem in one single place where we use
time.Unix(0, syscall.Filetime{...}.Nanoseconds())by implementing the logic locally, but there are others.@rsc suggested we add new method
in
syscallandgolang.org/x/sys/windowspackages so new method can be used asI created CL 758981 that contains the proposed change for
syscallpackage as an example.CC @golang/windows and @gremat (who did all the work in #74335 and CL 682816)