2022-04-23 16:38:50 +00:00
|
|
|
//go:build darwin || dragonfly || freebsd || openbsd || linux || netbsd || solaris
|
2017-10-20 09:39:11 +00:00
|
|
|
// +build darwin dragonfly freebsd openbsd linux netbsd solaris
|
|
|
|
|
|
|
|
package mtree
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"golang.org/x/sys/unix"
|
|
|
|
)
|
|
|
|
|
|
|
|
func lchtimes(name string, atime time.Time, mtime time.Time) error {
|
|
|
|
utimes := []unix.Timespec{
|
|
|
|
unix.NsecToTimespec(atime.UnixNano()),
|
|
|
|
unix.NsecToTimespec(mtime.UnixNano()),
|
|
|
|
}
|
|
|
|
if e := unix.UtimesNanoAt(unix.AT_FDCWD, name, utimes, unix.AT_SYMLINK_NOFOLLOW); e != nil {
|
|
|
|
return &os.PathError{Op: "chtimes", Path: name, Err: e}
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|