summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Symonds <dsymonds@golang.org>2014-06-03 16:13:38 +1000
committerDavid Symonds <dsymonds@golang.org>2014-06-03 16:13:38 +1000
commitda19af184549de163d44ad83aaaeaf4b4f38d441 (patch)
tree3d80133a6d6e30ab2a27482bf822f04dd3950c5b
parent837dce6cd14b9bda0efad2dbb7d80764b02d1fc2 (diff)
downloadgo-da19af184549de163d44ad83aaaeaf4b4f38d441.tar.gz
[release-branch.go1.3] time: support version 3 zone records
??? CL 100930044 / fde405c62fca time: support version 3 zone records Fixes Issue 8134 LGTM=iant R=golang-codereviews, iant CC=golang-codereviews, r, rsc https://codereview.appspot.com/100930044 ??? LGTM=rsc R=adg, rsc CC=golang-codereviews https://codereview.appspot.com/96690043
-rw-r--r--src/pkg/time/zoneinfo_read.go4
-rw-r--r--src/pkg/time/zoneinfo_test.go9
2 files changed, 11 insertions, 2 deletions
diff --git a/src/pkg/time/zoneinfo_read.go b/src/pkg/time/zoneinfo_read.go
index 4bb4bf665..de9ebb41c 100644
--- a/src/pkg/time/zoneinfo_read.go
+++ b/src/pkg/time/zoneinfo_read.go
@@ -68,7 +68,7 @@ func loadZoneData(bytes []byte) (l *Location, err error) {
// 1-byte version, then 15 bytes of padding
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
}
@@ -123,7 +123,7 @@ func loadZoneData(bytes []byte) (l *Location, err error) {
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.
// We won't need those until 2106.
diff --git a/src/pkg/time/zoneinfo_test.go b/src/pkg/time/zoneinfo_test.go
index 4653babc2..4ca7fad93 100644
--- a/src/pkg/time/zoneinfo_test.go
+++ b/src/pkg/time/zoneinfo_test.go
@@ -9,6 +9,15 @@ import (
"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
// transition time. To do this we explicitly check early dates in a
// couple of specific timezones.