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.
4
5// +build darwin
6// +build arm arm64
7
8package time
9
10import "syscall"
11
12var zoneFile string
13
14func init() {
15	wd, err := syscall.Getwd()
16	if err != nil {
17		return
18	}
19
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"
24}
25
26func forceZipFileForTesting(zipOnly bool) {
27	// On iOS we only have the zip file.
28}
29
30func initTestingZone() {
31	z, err := loadZoneFile(zoneFile, "America/Los_Angeles")
32	if err != nil {
33		panic("cannot load America/Los_Angeles for testing: " + err.Error())
34	}
35	z.name = "Local"
36	localLoc = *z
37}
38
39func initLocal() {
40	// TODO(crawshaw): [NSTimeZone localTimeZone]
41	localLoc = *UTC
42}
43
44func loadLocation(name string) (*Location, error) {
45	z, err := loadZoneFile(zoneFile, name)
46	if err != nil {
47		return nil, err
48	}
49	z.name = name
50	return z, nil
51}
52