1
0
Fork 0
mirror of https://github.com/vbatts/go-mtree.git synced 2024-11-14 12:48:44 +00:00
go-mtree/lchtimes_unix.go
Vincent Batts 94303e15af
*.go: updated go:build added via gofmt
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2022-04-23 12:59:26 -04:00

23 lines
567 B
Go

//go:build darwin || dragonfly || freebsd || openbsd || linux || netbsd || solaris
// +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
}