9c4864badd
The size of `stat_t` fields is architecture dependent, which was reportedly causing a build failure on FreeBSD ARM7 32-bit systems. This changeset matches the behavior we have on Linux.
18 lines
412 B
Go
18 lines
412 B
Go
//go:build darwin || freebsd || netbsd || openbsd
|
|
// +build darwin freebsd netbsd openbsd
|
|
|
|
package agent
|
|
|
|
import (
|
|
"os"
|
|
"syscall"
|
|
"time"
|
|
)
|
|
|
|
func (l *logFile) createTime(stat os.FileInfo) time.Time {
|
|
stat_t := stat.Sys().(*syscall.Stat_t)
|
|
createTime := stat_t.Ctimespec
|
|
// Sec and Nsec are int32 in 32-bit architectures.
|
|
return time.Unix(int64(createTime.Sec), int64(createTime.Nsec)) //nolint:unconvert
|
|
}
|