You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
437 B
21 lines
437 B
// 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
|
|
}
|
|
|