1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2024-12-22 00:36:41 +02:00
crud_generator/vendor/github.com/otiai10/copy/preserve_ltimes.go

21 lines
384 B
Go
Raw Normal View History

2023-11-15 12:58:31 +02:00
//go:build !windows && !plan9 && !js
// +build !windows,!plan9,!js
package copy
import (
"golang.org/x/sys/unix"
)
func preserveLtimes(src, dest string) error {
info := new(unix.Stat_t)
if err := unix.Lstat(src, info); err != nil {
return err
}
return unix.Lutimes(dest, []unix.Timeval{
unix.NsecToTimeval(info.Atim.Nano()),
unix.NsecToTimeval(info.Mtim.Nano()),
})
}