Docker-DCO-1.1-Signed-off-by: Kato Kazuyoshi <kato.kazuyoshi@gmail.com> (github: kzys)
| ... | ... |
@@ -9,7 +9,6 @@ import ( |
| 9 | 9 |
"path/filepath" |
| 10 | 10 |
"strings" |
| 11 | 11 |
"syscall" |
| 12 |
- "time" |
|
| 13 | 12 |
) |
| 14 | 13 |
|
| 15 | 14 |
// Linux device nodes are a bit weird due to backwards compat with 16 bit device nodes. |
| ... | ... |
@@ -18,15 +17,6 @@ import ( |
| 18 | 18 |
func mkdev(major int64, minor int64) uint32 {
|
| 19 | 19 |
return uint32(((minor & 0xfff00) << 12) | ((major & 0xfff) << 8) | (minor & 0xff)) |
| 20 | 20 |
} |
| 21 |
-func timeToTimespec(time time.Time) (ts syscall.Timespec) {
|
|
| 22 |
- if time.IsZero() {
|
|
| 23 |
- // Return UTIME_OMIT special value |
|
| 24 |
- ts.Sec = 0 |
|
| 25 |
- ts.Nsec = ((1 << 30) - 2) |
|
| 26 |
- return |
|
| 27 |
- } |
|
| 28 |
- return syscall.NsecToTimespec(time.UnixNano()) |
|
| 29 |
-} |
|
| 30 | 21 |
|
| 31 | 22 |
// ApplyLayer parses a diff in the standard layer format from `layer`, and |
| 32 | 23 |
// applies it to the directory `dest`. |
| 33 | 24 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,16 @@ |
| 0 |
+package archive |
|
| 1 |
+ |
|
| 2 |
+import ( |
|
| 3 |
+ "syscall" |
|
| 4 |
+ "time" |
|
| 5 |
+) |
|
| 6 |
+ |
|
| 7 |
+func timeToTimespec(time time.Time) (ts syscall.Timespec) {
|
|
| 8 |
+ if time.IsZero() {
|
|
| 9 |
+ // Return UTIME_OMIT special value |
|
| 10 |
+ ts.Sec = 0 |
|
| 11 |
+ ts.Nsec = ((1 << 30) - 2) |
|
| 12 |
+ return |
|
| 13 |
+ } |
|
| 14 |
+ return syscall.NsecToTimespec(time.UnixNano()) |
|
| 15 |
+} |
| 0 | 16 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,16 @@ |
| 0 |
+// +build !linux |
|
| 1 |
+ |
|
| 2 |
+package archive |
|
| 3 |
+ |
|
| 4 |
+import ( |
|
| 5 |
+ "syscall" |
|
| 6 |
+ "time" |
|
| 7 |
+) |
|
| 8 |
+ |
|
| 9 |
+func timeToTimespec(time time.Time) (ts syscall.Timespec) {
|
|
| 10 |
+ nsec := int64(0) |
|
| 11 |
+ if !time.IsZero() {
|
|
| 12 |
+ nsec = time.UnixNano() |
|
| 13 |
+ } |
|
| 14 |
+ return syscall.NsecToTimespec(nsec) |
|
| 15 |
+} |