diff --git a/src/archive/zip/struct.go b/src/archive/zip/struct.go index 41d79ca0a62..686e79781ac 100644 --- a/src/archive/zip/struct.go +++ b/src/archive/zip/struct.go @@ -159,7 +159,7 @@ func (fi headerFileInfo) ModTime() time.Time { if fi.fh.Modified.IsZero() { return fi.fh.ModTime() } - return fi.fh.Modified + return fi.fh.Modified.UTC() } func (fi headerFileInfo) Mode() os.FileMode { return fi.fh.Mode() } func (fi headerFileInfo) Sys() interface{} { return fi.fh } @@ -178,7 +178,6 @@ func FileInfoHeader(fi os.FileInfo) (*FileHeader, error) { UncompressedSize64: uint64(size), } fh.SetModTime(fi.ModTime()) - fh.Modified = fi.ModTime() fh.SetMode(fi.Mode()) if fh.UncompressedSize64 > uint32max { fh.UncompressedSize = uint32max diff --git a/src/archive/zip/zip_test.go b/src/archive/zip/zip_test.go index 1b1984f3857..efdb5bd0447 100644 --- a/src/archive/zip/zip_test.go +++ b/src/archive/zip/zip_test.go @@ -127,10 +127,10 @@ func TestFileHeaderRoundTripModified(t *testing.T) { if err != nil { t.Fatal(err) } - if got, want := fh2.Modified, fh.Modified; got != want { + if got, want := fh2.Modified, fh.Modified.UTC(); got != want { t.Errorf("Modified: got %s, want %s\n", got, want) } - if got, want := fi.ModTime(), fh.Modified; got != want { + if got, want := fi.ModTime(), fh.Modified.UTC(); got != want { t.Errorf("Modified: got %s, want %s\n", got, want) } }