aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Crawshaw <crawshaw@golang.org>2015-03-03 07:45:06 -0500
committerDavid Crawshaw <crawshaw@golang.org>2015-03-03 15:37:14 +0000
commitce1c9247b06800d6698d03dcd68498729f7bfddd (patch)
tree5d40ef70150520120b6796fa87bdc881c950e0b8 /src
parentb69ea0185146fc114a5025af666fbb9590d7b518 (diff)
downloadgo-ce1c9247b06800d6698d03dcd68498729f7bfddd.tar.xz
time: zoneinfo support for darwin
Roll forward of 54efdc596f7b. Better testing of the build on darwin/amd64. There is still some variance between cmd/dist and the Go tool for build tag handling. Change-Id: I105669ae7f90c8c89b3839c04b182cff46be8dde Reviewed-on: https://go-review.googlesource.com/6516 Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/time/sleep_test.go4
-rw-r--r--src/time/zoneinfo_ios.go51
-rw-r--r--src/time/zoneinfo_unix.go2
3 files changed, 56 insertions, 1 deletions
diff --git a/src/time/sleep_test.go b/src/time/sleep_test.go
index c9b2956b78..6452a9e027 100644
--- a/src/time/sleep_test.go
+++ b/src/time/sleep_test.go
@@ -383,6 +383,10 @@ func TestOverflowSleep(t *testing.T) {
// Test that a panic while deleting a timer does not leave
// the timers mutex held, deadlocking a ticker.Stop in a defer.
func TestIssue5745(t *testing.T) {
+ if runtime.GOOS == "darwin" && runtime.GOARCH == "arm" {
+ t.Skipf("skipping on %s/%s, see issue 10043", runtime.GOOS, runtime.GOARCH)
+ }
+
ticker := NewTicker(Hour)
defer func() {
// would deadlock here before the fix due to
diff --git a/src/time/zoneinfo_ios.go b/src/time/zoneinfo_ios.go
new file mode 100644
index 0000000000..f09166c89e
--- /dev/null
+++ b/src/time/zoneinfo_ios.go
@@ -0,0 +1,51 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build darwin
+// +build arm arm64
+
+package time
+
+import "syscall"
+
+var zoneFile string
+
+func init() {
+ wd, err := syscall.Getwd()
+ if err != nil {
+ return
+ }
+
+ // The working directory at initialization is the root of the
+ // app bundle: "/private/.../bundlename.app". That's where we
+ // keep zoneinfo.zip.
+ zoneFile = wd + "/zoneinfo.zip"
+}
+
+func forceZipFileForTesting(zipOnly bool) {
+ // On iOS we only have the zip file.
+}
+
+func initTestingZone() {
+ z, err := loadZoneFile(zoneFile, "America/Los_Angeles")
+ if err != nil {
+ panic("cannot load America/Los_Angeles for testing: " + err.Error())
+ }
+ z.name = "Local"
+ localLoc = *z
+}
+
+func initLocal() {
+ // TODO(crawshaw): [NSTimeZone localTimeZone]
+ localLoc = *UTC
+}
+
+func loadLocation(name string) (*Location, error) {
+ z, err := loadZoneFile(zoneFile, name)
+ if err != nil {
+ return nil, err
+ }
+ z.name = name
+ return z, nil
+}
diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go
index 66540969d5..ed9502da57 100644
--- a/src/time/zoneinfo_unix.go
+++ b/src/time/zoneinfo_unix.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
+// +build darwin,386 darwin,amd64 dragonfly freebsd linux nacl netbsd openbsd solaris
// Parse "zoneinfo" time zone file.
// This is a fairly standard file format used on OS X, Linux, BSD, Sun, and others.