aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Tsai <joetsai@digital-static.net>2017-11-09 16:07:29 -0800
committerJoe Tsai <thebrokentoaster@gmail.com>2017-11-10 00:27:33 +0000
commitbdf30565e2810794a6f5d7cf998e64cc4084c98b (patch)
tree49f876c16d719015581e21a7b8fa63ff627b2d3c
parent95322a3ac68b206c3394329cb00a0d511e77e0f9 (diff)
downloadgo-bdf30565e2810794a6f5d7cf998e64cc4084c98b.tar.gz
go-bdf30565e2810794a6f5d7cf998e64cc4084c98b.zip
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 <thebrokentoaster@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
-rw-r--r--src/archive/zip/reader.go2
-rw-r--r--src/archive/zip/struct.go4
2 files changed, 3 insertions, 3 deletions
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)
}