File: stat.go

package info (click to toggle)
golang-github-djherbis-atime 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 124 kB
  • sloc: makefile: 2
file content (21 lines) | stat: -rw-r--r-- 437 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// 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
}