github.com/mailru/activerecord@v1.12.2/pkg/iproto/util/time/monotonic_darwin.go (about)

     1  package time
     2  
     3  import "time"
     4  
     5  // Monotonic returns nanoseconds passed from some point in past.
     6  // Note that returned value is not persistent. That is, returned value is no longer actual after system restart.
     7  func Monotonic() (MonotonicTimestamp, error) {
     8  	now := time.Now()
     9  	sec := now.Unix()
    10  	nsec := int32(now.UnixNano() - sec*1e9)
    11  	return MonotonicTimestamp{
    12  		sec:  sec,
    13  		nsec: nsec,
    14  	}, nil
    15  }