e95f4619cd
Changes most references of syscall to golang.org/x/sys/ Ones aren't changes include, Errno, Signal and SysProcAttr as they haven't been implemented in /x/sys/. Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com> [s390x] switch utsname from unsigned to signed per https://github.com/golang/sys/commit/33267e036fd93fcd26ea95b7bdaf2d8306cb743c char in s390x in the /x/sys/unix package is now signed, so change the buildtags Signed-off-by: Christopher Jones <tophj@linux.vnet.ibm.com> Upstream-commit: 069fdc8a083cb1663e4f86fe3fd9b9a1aebc3e54 Component: engine
29 lines
730 B
Go
29 lines
730 B
Go
// +build windows
|
|
|
|
package system
|
|
|
|
import (
|
|
"time"
|
|
|
|
"golang.org/x/sys/windows"
|
|
)
|
|
|
|
//setCTime will set the create time on a file. On Windows, this requires
|
|
//calling SetFileTime and explicitly including the create time.
|
|
func setCTime(path string, ctime time.Time) error {
|
|
ctimespec := windows.NsecToTimespec(ctime.UnixNano())
|
|
pathp, e := windows.UTF16PtrFromString(path)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
h, e := windows.CreateFile(pathp,
|
|
windows.FILE_WRITE_ATTRIBUTES, windows.FILE_SHARE_WRITE, nil,
|
|
windows.OPEN_EXISTING, windows.FILE_FLAG_BACKUP_SEMANTICS, 0)
|
|
if e != nil {
|
|
return e
|
|
}
|
|
defer windows.Close(h)
|
|
c := windows.NsecToFiletime(windows.TimespecToNsec(ctimespec))
|
|
return windows.SetFileTime(h, &c, nil, nil)
|
|
}
|