Skip to content

Commit cfc8939

Browse files
[release-branch.go1.14] time: support slim tzdata format
Backport of part of https://golang.org/cl/261877 to support the slim tzdata format. As of tzdata 2020b, the default is to use the slim format. We need to support that format so that Go installations continue to work when tzdata is updated. Relevant part of the CL description: The reason for the failed tests was that when caching location data, the extended time format past the end of zone transitions was not considered. The respective change was introduced in (*Location).lookup by CL 215539. For #42155 Change-Id: I37f52a0917b2c6e3957e6b4612c8ef104c736e65 Reviewed-on: https://go-review.googlesource.com/c/go/+/264301 Trust: Ian Lance Taylor <[email protected]> Reviewed-by: Tobias Klauser <[email protected]> (cherry picked from commit 414668c) Reviewed-on: https://go-review.googlesource.com/c/go/+/266298 Run-TryBot: Ian Lance Taylor <[email protected]>
1 parent 1f040e0 commit cfc8939

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/time/zoneinfo_read.go

+8
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,16 @@ func LoadLocationFromTZData(name string, data []byte) (*Location, error) {
313313
l.cacheEnd = omega
314314
if i+1 < len(tx) {
315315
l.cacheEnd = tx[i+1].when
316+
} else if l.extend != "" {
317+
// If we're at the end of the known zone transitions,
318+
// try the extend string.
319+
if _, _, estart, eend, ok := tzset(l.extend, l.cacheEnd, sec); ok {
320+
l.cacheStart = estart
321+
l.cacheEnd = eend
322+
}
316323
}
317324
l.cacheZone = &l.zone[tx[i].index]
325+
break
318326
}
319327
}
320328

0 commit comments

Comments
 (0)