github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/command/agent/log_file_bsd.go (about)

     1  //go:build darwin || freebsd || netbsd || openbsd
     2  // +build darwin freebsd netbsd openbsd
     3  
     4  package agent
     5  
     6  import (
     7  	"os"
     8  	"syscall"
     9  	"time"
    10  )
    11  
    12  func (l *logFile) createTime(stat os.FileInfo) time.Time {
    13  	stat_t := stat.Sys().(*syscall.Stat_t)
    14  	createTime := stat_t.Ctimespec
    15  	// Sec and Nsec are int32 in 32-bit architectures.
    16  	return time.Unix(int64(createTime.Sec), int64(createTime.Nsec)) //nolint:unconvert
    17  }