github.com/demonoid81/moby@v0.0.0-20200517203328-62dd8e17c460/pkg/archive/time_linux.go (about)

     1  package archive // import "github.com/demonoid81/moby/pkg/archive"
     2  
     3  import (
     4  	"syscall"
     5  	"time"
     6  )
     7  
     8  func timeToTimespec(time time.Time) (ts syscall.Timespec) {
     9  	if time.IsZero() {
    10  		// Return UTIME_OMIT special value
    11  		ts.Sec = 0
    12  		ts.Nsec = (1 << 30) - 2
    13  		return
    14  	}
    15  	return syscall.NsecToTimespec(time.UnixNano())
    16  }