github.com/thy00/storage@v1.12.8/lockfile_otherunix.go (about)

     1  // +build darwin freebsd
     2  
     3  package storage
     4  
     5  import (
     6  	"time"
     7  
     8  	"golang.org/x/sys/unix"
     9  )
    10  
    11  func (l *lockfile) TouchedSince(when time.Time) bool {
    12  	st := unix.Stat_t{}
    13  	err := unix.Fstat(int(l.fd), &st)
    14  	if err != nil {
    15  		return true
    16  	}
    17  	touched := time.Unix(st.Mtimespec.Unix())
    18  	return when.Before(touched)
    19  }