summaryrefslogtreecommitdiff
path: root/src/pkg/time/zoneinfo_unix.go
diff options
context:
space:
mode:
authorTianon Gravi <admwiggin@gmail.com>2015-01-15 11:54:00 -0700
committerTianon Gravi <admwiggin@gmail.com>2015-01-15 11:54:00 -0700
commitf154da9e12608589e8d5f0508f908a0c3e88a1bb (patch)
treef8255d51e10c6f1e0ed69702200b966c9556a431 /src/pkg/time/zoneinfo_unix.go
parent8d8329ed5dfb9622c82a9fbec6fd99a580f9c9f6 (diff)
downloadgolang-upstream/1.4.tar.gz
Imported Upstream version 1.4upstream/1.4
Diffstat (limited to 'src/pkg/time/zoneinfo_unix.go')
-rw-r--r--src/pkg/time/zoneinfo_unix.go84
1 files changed, 0 insertions, 84 deletions
diff --git a/src/pkg/time/zoneinfo_unix.go b/src/pkg/time/zoneinfo_unix.go
deleted file mode 100644
index ab7e4612e..000000000
--- a/src/pkg/time/zoneinfo_unix.go
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2009 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 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.
-// See tzfile(5), http://en.wikipedia.org/wiki/Zoneinfo,
-// and ftp://munnari.oz.au/pub/oldtz/
-
-package time
-
-import (
- "errors"
- "runtime"
- "syscall"
-)
-
-func initTestingZone() {
- z, err := loadZoneFile(runtime.GOROOT()+"/lib/time/zoneinfo.zip", "America/Los_Angeles")
- if err != nil {
- panic("cannot load America/Los_Angeles for testing: " + err.Error())
- }
- z.name = "Local"
- localLoc = *z
-}
-
-// Many systems use /usr/share/zoneinfo, Solaris 2 has
-// /usr/share/lib/zoneinfo, IRIX 6 has /usr/lib/locale/TZ.
-var zoneDirs = []string{
- "/usr/share/zoneinfo/",
- "/usr/share/lib/zoneinfo/",
- "/usr/lib/locale/TZ/",
- runtime.GOROOT() + "/lib/time/zoneinfo.zip",
-}
-
-var origZoneDirs = zoneDirs
-
-func forceZipFileForTesting(zipOnly bool) {
- zoneDirs = make([]string, len(origZoneDirs))
- copy(zoneDirs, origZoneDirs)
- if zipOnly {
- for i := 0; i < len(zoneDirs)-1; i++ {
- zoneDirs[i] = "/XXXNOEXIST"
- }
- }
-}
-
-func initLocal() {
- // consult $TZ to find the time zone to use.
- // no $TZ means use the system default /etc/localtime.
- // $TZ="" means use UTC.
- // $TZ="foo" means use /usr/share/zoneinfo/foo.
-
- tz, ok := syscall.Getenv("TZ")
- switch {
- case !ok:
- z, err := loadZoneFile("", "/etc/localtime")
- if err == nil {
- localLoc = *z
- localLoc.name = "Local"
- return
- }
- case tz != "" && tz != "UTC":
- if z, err := loadLocation(tz); err == nil {
- localLoc = *z
- return
- }
- }
-
- // Fall back to UTC.
- localLoc.name = "UTC"
-}
-
-func loadLocation(name string) (*Location, error) {
- for _, zoneDir := range zoneDirs {
- if z, err := loadZoneFile(zoneDir, name); err == nil {
- z.name = name
- return z, nil
- }
- }
- return nil, errors.New("unknown time zone " + name)
-}