Skip to content

Commit

Permalink
fix ctime
Browse files Browse the repository at this point in the history
  • Loading branch information
nikandfor committed Dec 31, 2023
1 parent 0a46fa1 commit 1f74ee7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rotating/ctime_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ func fileCtime(fstat func(string) (fs.FileInfo, error), name string, now time.Ti
}

func ctime(inf fs.FileInfo, now time.Time) time.Time {
stat, ok := inf.Sys().(*syscall.Stat_t)
stat, ok := inf.Sys().(*syscall.Win32FileAttributeData)
if !ok {
return now
}

return time.Unix(stat.Ctim.Unix())
return time.Unix(0, stat.CreationTime.Nanoseconds())
}

0 comments on commit 1f74ee7

Please sign in to comment.