mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-27 02:40:30 +00:00
21 lines
437 B
Go
21 lines
437 B
Go
// Package atime provides a platform-independent way to get atimes for files.
|
|
package atime
|
|
|
|
import (
|
|
"os"
|
|
"time"
|
|
)
|
|
|
|
// Get returns the Last Access Time for the given FileInfo
|
|
func Get(fi os.FileInfo) time.Time {
|
|
return atime(fi)
|
|
}
|
|
|
|
// Stat returns the Last Access Time for the given filename
|
|
func Stat(name string) (time.Time, error) {
|
|
fi, err := os.Stat(name)
|
|
if err != nil {
|
|
return time.Time{}, err
|
|
}
|
|
return atime(fi), nil
|
|
}
|