]> Cypherpunks repositories - gostls13.git/commitdiff
archive/zip: use Time.UTC instead of Time.In(time.UTC)
authorJoe Tsai <joetsai@digital-static.net>
Fri, 10 Nov 2017 00:07:29 +0000 (16:07 -0800)
committerJoe Tsai <thebrokentoaster@gmail.com>
Fri, 10 Nov 2017 00:27:33 +0000 (00:27 +0000)
The former is more succinct and readable.

Change-Id: Ic249d1261a705ad715aeb611c70c7fa91db98254
Reviewed-on: https://go-review.googlesource.com/76830
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/archive/zip/reader.go
src/archive/zip/struct.go

index 7417b8f36afc98751a5ccd131f40f9ecf3e4949c..1563e74dfceda7d29f81ed8a367924c15a9115e3 100644 (file)
@@ -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.
index f2bc7be6a5ac048e687d1ece694bf6ec2d0ad728..00c15e4931a98332922257b204eb2c55bfbc5796 100644 (file)
@@ -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)
 }