PR ada/66526
[official-gcc.git] / libgo / go / time / zoneinfo_ios.go
blobf09166c89e9cda30f2f3a7c6e1e9a114314f9eab
1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // +build darwin
6 // +build arm arm64
8 package time
10 import "syscall"
12 var zoneFile string
14 func init() {
15 wd, err := syscall.Getwd()
16 if err != nil {
17 return
20 // The working directory at initialization is the root of the
21 // app bundle: "/private/.../bundlename.app". That's where we
22 // keep zoneinfo.zip.
23 zoneFile = wd + "/zoneinfo.zip"
26 func forceZipFileForTesting(zipOnly bool) {
27 // On iOS we only have the zip file.
30 func initTestingZone() {
31 z, err := loadZoneFile(zoneFile, "America/Los_Angeles")
32 if err != nil {
33 panic("cannot load America/Los_Angeles for testing: " + err.Error())
35 z.name = "Local"
36 localLoc = *z
39 func initLocal() {
40 // TODO(crawshaw): [NSTimeZone localTimeZone]
41 localLoc = *UTC
44 func loadLocation(name string) (*Location, error) {
45 z, err := loadZoneFile(zoneFile, name)
46 if err != nil {
47 return nil, err
49 z.name = name
50 return z, nil