gitee.com/sy_183/go-common@v1.0.5-0.20231205030221-958cfe129b47/ipc/cgo/sem/time.go (about)

     1  package sem
     2  
     3  import "time"
     4  
     5  type timeSpec struct {
     6  	sec  int64
     7  	nsec int64
     8  }
     9  
    10  func durationToTimeSpec(duration time.Duration) timeSpec {
    11  	return timeSpec{
    12  		sec:  int64(duration / 1e9),
    13  		nsec: int64(duration % 1e9 / 1e3),
    14  	}
    15  }