summaryrefslogtreecommitdiff
path: root/vendor/github.com/moby/go-archive/time_windows.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/moby/go-archive/time_windows.go')
-rw-r--r--vendor/github.com/moby/go-archive/time_windows.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/vendor/github.com/moby/go-archive/time_windows.go b/vendor/github.com/moby/go-archive/time_windows.go
new file mode 100644
index 0000000..af1f7c8
--- /dev/null
+++ b/vendor/github.com/moby/go-archive/time_windows.go
@@ -0,0 +1,32 @@
+package archive
+
+import (
+ "os"
+ "time"
+
+ "golang.org/x/sys/windows"
+)
+
+func chtimes(name string, atime time.Time, mtime time.Time) error {
+ if err := os.Chtimes(name, atime, mtime); err != nil {
+ return err
+ }
+
+ pathp, err := windows.UTF16PtrFromString(name)
+ if err != nil {
+ return err
+ }
+ h, err := windows.CreateFile(pathp,
+ windows.FILE_WRITE_ATTRIBUTES, windows.FILE_SHARE_WRITE, nil,
+ windows.OPEN_EXISTING, windows.FILE_FLAG_BACKUP_SEMANTICS, 0)
+ if err != nil {
+ return err
+ }
+ defer windows.Close(h)
+ c := windows.NsecToFiletime(mtime.UnixNano())
+ return windows.SetFileTime(h, &c, nil, nil)
+}
+
+func lchtimes(name string, atime time.Time, mtime time.Time) error {
+ return nil
+}