diff options
Diffstat (limited to 'src/time/zoneinfo_read.go')
-rw-r--r-- | src/time/zoneinfo_read.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/time/zoneinfo_read.go b/src/time/zoneinfo_read.go index b79bd474c7..698427b779 100644 --- a/src/time/zoneinfo_read.go +++ b/src/time/zoneinfo_read.go @@ -311,17 +311,26 @@ func LoadLocationFromTZData(name string, data []byte) (*Location, error) { if tx[i].when <= sec && (i+1 == len(tx) || sec < tx[i+1].when) { l.cacheStart = tx[i].when l.cacheEnd = omega + zoneIdx := tx[i].index if i+1 < len(tx) { l.cacheEnd = tx[i+1].when } else if l.extend != "" { // If we're at the end of the known zone transitions, // try the extend string. - if _, _, estart, eend, ok := tzset(l.extend, l.cacheEnd, sec); ok { + if name, _, estart, eend, ok := tzset(l.extend, l.cacheEnd, sec); ok { l.cacheStart = estart l.cacheEnd = eend + // Find the zone that is returned by tzset, + // the last transition is not always the correct zone. + for i, z := range l.zone { + if z.name == name { + zoneIdx = uint8(i) + break + } + } } } - l.cacheZone = &l.zone[tx[i].index] + l.cacheZone = &l.zone[zoneIdx] break } } |