mirror of
https://github.com/golang/go
synced 2024-11-19 14:24:47 -07:00
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>
This commit is contained in:
parent
95322a3ac6
commit
bdf30565e2
@ -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.
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user