* gcc.dg/ipa/inlinehint-4.c: Also pass --param inline-unit-growth=20.
[official-gcc.git] / libgo / go / time / zoneinfo_unix.go
blob32dc7d504087384f91723844e5c918b875b0251d
1 // Copyright 2009 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 aix darwin,386 darwin,amd64 dragonfly freebsd linux,!android nacl netbsd openbsd solaris
7 // Parse "zoneinfo" time zone file.
8 // This is a fairly standard file format used on OS X, Linux, BSD, Sun, and others.
9 // See tzfile(5), http://en.wikipedia.org/wiki/Zoneinfo,
10 // and ftp://munnari.oz.au/pub/oldtz/
12 package time
14 import (
15 "runtime"
16 "syscall"
19 // Many systems use /usr/share/zoneinfo, Solaris 2 has
20 // /usr/share/lib/zoneinfo, IRIX 6 has /usr/lib/locale/TZ.
21 var zoneSources = []string{
22 "/usr/share/zoneinfo/",
23 "/usr/share/lib/zoneinfo/",
24 "/usr/lib/locale/TZ/",
25 runtime.GOROOT() + "/lib/time/zoneinfo.zip",
28 func initLocal() {
29 // consult $TZ to find the time zone to use.
30 // no $TZ means use the system default /etc/localtime.
31 // $TZ="" means use UTC.
32 // $TZ="foo" means use /usr/share/zoneinfo/foo.
34 tz, ok := syscall.Getenv("TZ")
35 switch {
36 case !ok:
37 z, err := loadLocation("localtime", []string{"/etc/"})
38 if err == nil {
39 localLoc = *z
40 localLoc.name = "Local"
41 return
43 case tz != "" && tz != "UTC":
44 if z, err := loadLocation(tz, zoneSources); err == nil {
45 localLoc = *z
46 return
50 // Fall back to UTC.
51 localLoc.name = "UTC"