Skip to content

Commit 092b2c8

Browse files
authored
Merge pull request #193 from tklauser/timespec-unix
fs: use syscall.Timespec.Unix
2 parents 44b5ced + 030679c commit 092b2c8

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

fs/stat_atim.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ func StatMtime(st *syscall.Stat_t) syscall.Timespec {
4141

4242
// StatATimeAsTime returns st.Atim as a time.Time
4343
func StatATimeAsTime(st *syscall.Stat_t) time.Time {
44-
return time.Unix(int64(st.Atim.Sec), int64(st.Atim.Nsec)) //nolint: unconvert // int64 conversions ensure the line compiles for 32-bit systems as well.
44+
return time.Unix(st.Atim.Unix())
4545
}

fs/stat_darwinbsd.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ func StatMtime(st *syscall.Stat_t) syscall.Timespec {
4141

4242
// StatATimeAsTime returns the access time as a time.Time
4343
func StatATimeAsTime(st *syscall.Stat_t) time.Time {
44-
return time.Unix(int64(st.Atimespec.Sec), int64(st.Atimespec.Nsec)) //nolint: unconvert // int64 conversions ensure the line compiles for 32-bit systems as well.
44+
return time.Unix(st.Atimespec.Unix())
4545
}

0 commit comments

Comments
 (0)