From: Joe Tsai Date: Fri, 10 Nov 2017 00:07:29 +0000 (-0800) Subject: archive/zip: use Time.UTC instead of Time.In(time.UTC) X-Git-Tag: go1.10beta1~334 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=bdf30565e2810794a6f5d7cf998e64cc4084c98b;p=gostls13.git archive/zip: use Time.UTC instead of Time.In(time.UTC) The former is more succinct and readable. Change-Id: Ic249d1261a705ad715aeb611c70c7fa91db98254 Reviewed-on: https://go-review.googlesource.com/76830 Run-TryBot: Joe Tsai Reviewed-by: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- diff --git a/src/archive/zip/reader.go b/src/archive/zip/reader.go index 7417b8f36a..1563e74dfc 100644 --- a/src/archive/zip/reader.go +++ b/src/archive/zip/reader.go @@ -391,7 +391,7 @@ parseExtras: msdosModified := msDosTimeToTime(f.ModifiedDate, f.ModifiedTime) f.Modified = msdosModified if !modified.IsZero() { - f.Modified = modified.In(time.UTC) + f.Modified = modified.UTC() // If legacy MS-DOS timestamps are set, we can use the delta between // the legacy and extended versions to estimate timezone offset. diff --git a/src/archive/zip/struct.go b/src/archive/zip/struct.go index f2bc7be6a5..00c15e4931 100644 --- a/src/archive/zip/struct.go +++ b/src/archive/zip/struct.go @@ -231,7 +231,7 @@ func timeToMsDosTime(t time.Time) (fDate uint16, fTime uint16) { // Deprecated: Use Modified instead. func (h *FileHeader) ModTime() time.Time { if !h.Modified.IsZero() { - return h.Modified.In(time.UTC) // Convert to UTC for compatibility + return h.Modified.UTC() // Convert to UTC for compatibility } return msDosTimeToTime(h.ModifiedDate, h.ModifiedTime) } @@ -241,7 +241,7 @@ func (h *FileHeader) ModTime() time.Time { // // Deprecated: Use Modified instead. func (h *FileHeader) SetModTime(t time.Time) { - t = t.In(time.UTC) // Convert to UTC for compatibility + t = t.UTC() // Convert to UTC for compatibility h.Modified = t h.ModifiedDate, h.ModifiedTime = timeToMsDosTime(t) }