reflector-cleaner/atime/atime_linux.go

18 lines
271 B
Go
Raw Normal View History

2020-05-14 01:15:14 +02:00
// +build linux
package atime
import (
"os"
"syscall"
"time"
)
func timespecToTime(ts syscall.Timespec) time.Time {
return time.Unix(int64(ts.Sec), int64(ts.Nsec))
}
func Atime(fi os.FileInfo) time.Time {
return timespecToTime(fi.Sys().(*syscall.Stat_t).Atim)
}