diff options
Diffstat (limited to 'vendor/github.com/otiai10/copy/stat_times.go')
| -rw-r--r-- | vendor/github.com/otiai10/copy/stat_times.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/vendor/github.com/otiai10/copy/stat_times.go b/vendor/github.com/otiai10/copy/stat_times.go new file mode 100644 index 0000000..75f45f6 --- /dev/null +++ b/vendor/github.com/otiai10/copy/stat_times.go | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | //go:build !windows && !darwin && !freebsd && !plan9 && !netbsd && !js | ||
| 2 | // +build !windows,!darwin,!freebsd,!plan9,!netbsd,!js | ||
| 3 | |||
| 4 | // TODO: add more runtimes | ||
| 5 | |||
| 6 | package copy | ||
| 7 | |||
| 8 | import ( | ||
| 9 | "os" | ||
| 10 | "syscall" | ||
| 11 | "time" | ||
| 12 | ) | ||
| 13 | |||
| 14 | func getTimeSpec(info os.FileInfo) timespec { | ||
| 15 | stat := info.Sys().(*syscall.Stat_t) | ||
| 16 | times := timespec{ | ||
| 17 | Mtime: info.ModTime(), | ||
| 18 | Atime: time.Unix(int64(stat.Atim.Sec), int64(stat.Atim.Nsec)), | ||
| 19 | Ctime: time.Unix(int64(stat.Ctim.Sec), int64(stat.Ctim.Nsec)), | ||
| 20 | } | ||
| 21 | return times | ||
| 22 | } | ||
