Skip to content

Commit

Permalink
Merge pull request #193 from tklauser/timespec-unix
Browse files Browse the repository at this point in the history
fs: use syscall.Timespec.Unix
  • Loading branch information
AkihiroSuda authored Jan 7, 2022
2 parents 44b5ced + 030679c commit 092b2c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fs/stat_atim.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ func StatMtime(st *syscall.Stat_t) syscall.Timespec {

// StatATimeAsTime returns st.Atim as a time.Time
func StatATimeAsTime(st *syscall.Stat_t) time.Time {
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.
return time.Unix(st.Atim.Unix())
}
2 changes: 1 addition & 1 deletion fs/stat_darwinbsd.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ func StatMtime(st *syscall.Stat_t) syscall.Timespec {

// StatATimeAsTime returns the access time as a time.Time
func StatATimeAsTime(st *syscall.Stat_t) time.Time {
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.
return time.Unix(st.Atimespec.Unix())
}

0 comments on commit 092b2c8

Please sign in to comment.