Skip to content

Commit 414668c

Browse files
[release-branch.go1.15] 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 #42138 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]>
1 parent 777e455 commit 414668c

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
@@ -325,8 +325,16 @@ func LoadLocationFromTZData(name string, data []byte) (*Location, error) {
325325
l.cacheEnd = omega
326326
if i+1 < len(tx) {
327327
l.cacheEnd = tx[i+1].when
328+
} else if l.extend != "" {
329+
// If we're at the end of the known zone transitions,
330+
// try the extend string.
331+
if _, _, estart, eend, ok := tzset(l.extend, l.cacheEnd, sec); ok {
332+
l.cacheStart = estart
333+
l.cacheEnd = eend
334+
}
328335
}
329336
l.cacheZone = &l.zone[tx[i].index]
337+
break
330338
}
331339
}
332340

0 commit comments

Comments
 (0)