diff options
author | Filippo Valsorda <filippo@golang.org> | 2020-11-13 03:04:52 +0100 |
---|---|---|
committer | Filippo Valsorda <filippo@golang.org> | 2020-11-13 03:04:52 +0100 |
commit | 11087322f85d5ace6494fc194982d92f0a34df0f (patch) | |
tree | 1fc71e2b2e13647ad4a2a86f95794b47ca950e99 /src/time/zoneinfo_read.go | |
parent | ed9dc25d693c02aeeb8ed084b28b6d7f9489dc5a (diff) | |
parent | c53315d6cf1b4bfea6ff356b4a1524778c683bb9 (diff) | |
download | go-11087322f85d5ace6494fc194982d92f0a34df0f.tar.gz go-11087322f85d5ace6494fc194982d92f0a34df0f.zip |
[dev.boringcrypto.go1.15] all: merge go1.15.5 into dev.boringcrypto.go1.15
Change-Id: I075fd29b5d035cac905c7bc3145405bf622a981b
Diffstat (limited to 'src/time/zoneinfo_read.go')
-rw-r--r-- | src/time/zoneinfo_read.go | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/time/zoneinfo_read.go b/src/time/zoneinfo_read.go index 6f789be92a..22a60f3211 100644 --- a/src/time/zoneinfo_read.go +++ b/src/time/zoneinfo_read.go @@ -323,10 +323,27 @@ 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 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 } } |