mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 09:17:49 +08:00

full diff: -36ef4d8c0d...f098008783
-d5c1d785b0...5ae9b23c40
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
19 lines
465 B
Go
19 lines
465 B
Go
package system
|
|
|
|
import (
|
|
iofs "io/fs"
|
|
"syscall"
|
|
"time"
|
|
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
func Atime(st iofs.FileInfo) (time.Time, error) {
|
|
stSys, ok := st.Sys().(*syscall.Win32FileAttributeData)
|
|
if !ok {
|
|
return time.Time{}, errors.Errorf("expected st.Sys() to be *syscall.Win32FileAttributeData, got %T", st.Sys())
|
|
}
|
|
// ref: https://github.com/golang/go/blob/go1.19.2/src/os/types_windows.go#L230
|
|
return time.Unix(0, stSys.LastAccessTime.Nanoseconds()), nil
|
|
}
|