Commit 14a75ecf authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

time: support version 3 zone records

Fixes #8134

LGTM=iant
R=golang-codereviews, iant
CC=golang-codereviews, r, rsc
https://golang.org/cl/100930044
parent eb540792
...@@ -68,7 +68,7 @@ func loadZoneData(bytes []byte) (l *Location, err error) { ...@@ -68,7 +68,7 @@ func loadZoneData(bytes []byte) (l *Location, err error) {
// 1-byte version, then 15 bytes of padding // 1-byte version, then 15 bytes of padding
var p []byte var p []byte
if p = d.read(16); len(p) != 16 || p[0] != 0 && p[0] != '2' { if p = d.read(16); len(p) != 16 || p[0] != 0 && p[0] != '2' && p[0] != '3' {
return nil, badData return nil, badData
} }
...@@ -123,7 +123,7 @@ func loadZoneData(bytes []byte) (l *Location, err error) { ...@@ -123,7 +123,7 @@ func loadZoneData(bytes []byte) (l *Location, err error) {
return nil, badData return nil, badData
} }
// If version == 2, the entire file repeats, this time using // If version == 2 or 3, the entire file repeats, this time using
// 8-byte ints for txtimes and leap seconds. // 8-byte ints for txtimes and leap seconds.
// We won't need those until 2106. // We won't need those until 2106.
......
...@@ -9,6 +9,15 @@ import ( ...@@ -9,6 +9,15 @@ import (
"time" "time"
) )
func TestVersion3(t *testing.T) {
time.ForceZipFileForTesting(true)
defer time.ForceZipFileForTesting(false)
_, err := time.LoadLocation("Asia/Jerusalem")
if err != nil {
t.Fatal(err)
}
}
// Test that we get the correct results for times before the first // Test that we get the correct results for times before the first
// transition time. To do this we explicitly check early dates in a // transition time. To do this we explicitly check early dates in a
// couple of specific timezones. // couple of specific timezones.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment