You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
450 B
Go
23 lines
450 B
Go
//go:build darwin
|
|
// +build darwin
|
|
|
|
package starlog
|
|
|
|
import (
|
|
"os"
|
|
"syscall"
|
|
"time"
|
|
)
|
|
|
|
func timespecToTime(ts syscall.Timespec) time.Time {
|
|
return time.Unix(int64(ts.Sec), int64(ts.Nsec))
|
|
}
|
|
|
|
func GetFileCreationTime(fileinfo os.FileInfo) time.Time {
|
|
return timespecToTime(fileinfo.Sys().(*syscall.Stat_t).Ctimespec)
|
|
}
|
|
|
|
func GetFileAccessTime(fileinfo os.FileInfo) time.Time {
|
|
return timespecToTime(fileinfo.Sys().(*syscall.Stat_t).Atimespec)
|
|
}
|