forked from microsoft/docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request moby#5454 from kzys/utime-omit
UTIME_OMIT is only available on Linux
- Loading branch information
Showing
3 changed files
with
32 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package archive | ||
|
||
import ( | ||
"syscall" | ||
"time" | ||
) | ||
|
||
func timeToTimespec(time time.Time) (ts syscall.Timespec) { | ||
if time.IsZero() { | ||
// Return UTIME_OMIT special value | ||
ts.Sec = 0 | ||
ts.Nsec = ((1 << 30) - 2) | ||
return | ||
} | ||
return syscall.NsecToTimespec(time.UnixNano()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// +build !linux | ||
|
||
package archive | ||
|
||
import ( | ||
"syscall" | ||
"time" | ||
) | ||
|
||
func timeToTimespec(time time.Time) (ts syscall.Timespec) { | ||
nsec := int64(0) | ||
if !time.IsZero() { | ||
nsec = time.UnixNano() | ||
} | ||
return syscall.NsecToTimespec(nsec) | ||
} |