1
0
mirror of https://github.com/ManyakRus/crud_generator.git synced 2025-01-04 13:23:00 +02:00
crud_generator/vendor/github.com/otiai10/copy/stat_times.go

23 lines
484 B
Go
Raw Normal View History

2023-11-15 12:58:31 +02:00
//go:build !windows && !darwin && !freebsd && !plan9 && !netbsd && !js
// +build !windows,!darwin,!freebsd,!plan9,!netbsd,!js
// TODO: add more runtimes
package copy
import (
"os"
"syscall"
"time"
)
func getTimeSpec(info os.FileInfo) timespec {
stat := info.Sys().(*syscall.Stat_t)
times := timespec{
Mtime: info.ModTime(),
Atime: time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)),
Ctime: time.Unix(int64(stat.Ctim.Sec), int64(stat.Ctim.Nsec)),
}
return times
}