github.com/hustcat/docker@v1.3.3-0.20160314103604-901c67a8eeab/pkg/archive/time_linux.go (about)

     1  package 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  }