Browse Source

pkg/system: move maxTime init() back to Chtimes code

This code was moved to a separate file in fe5b34ba8828dc2f2f7db180a102cee360fec6e0,
but it's unclear why it was moved (as this file is not excluded on Windows).

Moving the code back into the chtimes file, to move it closer to where it's used.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 3 years ago
parent
commit
247f90c82e
2 changed files with 16 additions and 22 deletions
  1. 16 0
      pkg/system/chtimes.go
  2. 0 22
      pkg/system/init.go

+ 16 - 0
pkg/system/chtimes.go

@@ -2,9 +2,25 @@ package system // import "github.com/docker/docker/pkg/system"
 
 import (
 	"os"
+	"syscall"
 	"time"
+	"unsafe"
 )
 
+// Used by Chtimes
+var maxTime time.Time
+
+func init() {
+	if unsafe.Sizeof(syscall.Timespec{}.Nsec) == 8 {
+		// This is a 64 bit timespec
+		// os.Chtimes limits time to the following
+		maxTime = time.Unix(0, 1<<63-1)
+	} else {
+		// This is a 32 bit timespec
+		maxTime = time.Unix(1<<31-1, 0)
+	}
+}
+
 // Chtimes changes the access time and modified time of a file at the given path
 func Chtimes(name string, atime time.Time, mtime time.Time) error {
 	unixMinTime := time.Unix(0, 0)

+ 0 - 22
pkg/system/init.go

@@ -1,22 +0,0 @@
-package system // import "github.com/docker/docker/pkg/system"
-
-import (
-	"syscall"
-	"time"
-	"unsafe"
-)
-
-// Used by chtimes
-var maxTime time.Time
-
-func init() {
-	// chtimes initialization
-	if unsafe.Sizeof(syscall.Timespec{}.Nsec) == 8 {
-		// This is a 64 bit timespec
-		// os.Chtimes limits time to the following
-		maxTime = time.Unix(0, 1<<63-1)
-	} else {
-		// This is a 32 bit timespec
-		maxTime = time.Unix(1<<31-1, 0)
-	}
-}