mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
time: enable Location loading from user provided timezone data
The return values of the LoadLocation are inherently dependent on the runtime environment. Add LoadLocationFromTZData, whose results depend only on the timezone data provided as arguments. Fixes #20629 Change-Id: I43b181f4c05c219be3ec57327540263b7cb3b2aa Reviewed-on: https://go-review.googlesource.com/68890 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
9a14cd9e75
commit
2951f909ea
5 changed files with 37 additions and 10 deletions
|
|
@ -18,11 +18,11 @@ func initTestingZone() {
|
|||
localLoc = *z
|
||||
}
|
||||
|
||||
var origZoneSources = zoneSources
|
||||
var OrigZoneSources = zoneSources
|
||||
|
||||
func forceZipFileForTesting(zipOnly bool) {
|
||||
zoneSources = make([]string, len(origZoneSources))
|
||||
copy(zoneSources, origZoneSources)
|
||||
zoneSources = make([]string, len(OrigZoneSources))
|
||||
copy(zoneSources, OrigZoneSources)
|
||||
if zipOnly {
|
||||
zoneSources = zoneSources[len(zoneSources)-1:]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue