-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
898bd1e
commit 72685db
Showing
4 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//go:build darwin || freebsd || netbsd || openbsd | ||
// +build darwin freebsd netbsd openbsd | ||
|
||
package logging | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
"time" | ||
) | ||
|
||
func (l *LogFile) createTime(stat os.FileInfo) time.Time { | ||
stat_t := stat.Sys().(*syscall.Stat_t) | ||
createTime := stat_t.Ctimespec | ||
return time.Unix(createTime.Sec, createTime.Nsec) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//go:build dragonfly || linux || solaris | ||
// +build dragonfly linux solaris | ||
|
||
package logging | ||
|
||
import ( | ||
"os" | ||
"syscall" | ||
"time" | ||
) | ||
|
||
func (l *LogFile) createTime(stat os.FileInfo) time.Time { | ||
stat_t := stat.Sys().(*syscall.Stat_t) | ||
createTime := stat_t.Ctim | ||
// Sec and Nsec are int32 in 32-bit architectures. | ||
return time.Unix(int64(createTime.Sec), int64(createTime.Nsec)) //nolint:unconvert | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package logging | ||
|
||
import ( | ||
"os" | ||
"time" | ||
) | ||
|
||
func (l *LogFile) createTime(stat os.FileInfo) time.Time { | ||
// Use `ModTime` as an approximation if the exact create time is not | ||
// available. | ||
// On Windows, the file create time is not updated after the active log | ||
// rotates, so use `ModTime` as an approximation as well. | ||
return stat.ModTime() | ||
} |