Fix "PR c++/92804 ICE trying to use concept as a nested-name-specifier"
[official-gcc.git] / libgo / go / time / zoneinfo_ios.go
blobf5a97befd899cc9fff5658fa956317b4f1724f10
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 (
11 "runtime"
12 "syscall"
15 var zoneSources = []string{
16 getZoneRoot() + "/zoneinfo.zip",
19 func getZoneRoot() string {
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 for tethered iOS builds.
23 // For self-hosted iOS builds, the zoneinfo.zip is in GOROOT.
24 roots := []string{runtime.GOROOT() + "/lib/time"}
25 wd, err := syscall.Getwd()
26 if err == nil {
27 roots = append(roots, wd)
29 for _, r := range roots {
30 var st syscall.Stat_t
31 fd, err := syscall.Open(r, syscall.O_RDONLY, 0)
32 if err != nil {
33 continue
35 defer syscall.Close(fd)
36 if err := syscall.Fstat(fd, &st); err == nil {
37 return r
40 return "/XXXNOEXIST"
43 func initLocal() {
44 // TODO(crawshaw): [NSTimeZone localTimeZone]
45 localLoc = *UTC