From 54b2015005ff39a6043542e727679894cf72461d Mon Sep 17 00:00:00 2001 From: Geon Kim Date: Fri, 24 Feb 2023 18:09:48 +0900 Subject: [PATCH] time: fix timezone lookup logic for non-DST zones Fixes #58682 --- src/time/zoneinfo.go | 2 +- src/time/zoneinfo_read.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/time/zoneinfo.go b/src/time/zoneinfo.go index dd3b4edd01..d83e4d37d1 100644 --- a/src/time/zoneinfo.go +++ b/src/time/zoneinfo.go @@ -203,7 +203,7 @@ func (l *Location) lookup(sec int64) (name string, offset int, start, end int64, // If we're at the end of the known zone transitions, // try the extend string. if lo == len(tx)-1 && l.extend != "" { - if ename, eoffset, estart, eend, eisDST, ok := tzset(l.extend, end, sec); ok { + if ename, eoffset, estart, eend, eisDST, ok := tzset(l.extend, start, sec); ok { return ename, eoffset, estart, eend, eisDST } } diff --git a/src/time/zoneinfo_read.go b/src/time/zoneinfo_read.go index d8b35003a1..4d0e47d890 100644 --- a/src/time/zoneinfo_read.go +++ b/src/time/zoneinfo_read.go @@ -329,7 +329,7 @@ func LoadLocationFromTZData(name string, data []byte) (*Location, error) { } else if l.extend != "" { // If we're at the end of the known zone transitions, // try the extend string. - if name, offset, estart, eend, isDST, ok := tzset(l.extend, l.cacheEnd, sec); ok { + if name, offset, estart, eend, isDST, ok := tzset(l.extend, l.cacheStart, sec); ok { l.cacheStart = estart l.cacheEnd = eend // Find the zone that is returned by tzset to avoid allocation if possible.