github.com/rentongzhang/docker@v1.8.2-rc1/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  }