summaryrefslogtreecommitdiff
path: root/src/pkg/time
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-04-28 10:35:15 +0200
committerOndřej Surý <ondrej@sury.org>2011-04-28 10:35:15 +0200
commitc1ba1a0fec4aed430709030f98a3bdb90bfeea16 (patch)
tree3df18657e50a0313ed6defcda30e4474cb28a467 /src/pkg/time
parent7b15ed9ef455b6b66c6b376898a88aef5d6a9970 (diff)
downloadgolang-c1ba1a0fec4aed430709030f98a3bdb90bfeea16.tar.gz
Imported Upstream version 2011.04.27upstream/2011.04.27
Diffstat (limited to 'src/pkg/time')
-rw-r--r--src/pkg/time/time.go3
-rw-r--r--src/pkg/time/zoneinfo_unix.go16
2 files changed, 11 insertions, 8 deletions
diff --git a/src/pkg/time/time.go b/src/pkg/time/time.go
index 40338f775..a0480786a 100644
--- a/src/pkg/time/time.go
+++ b/src/pkg/time/time.go
@@ -2,8 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// The time package provides functionality for measuring and
-// displaying time.
+// Package time provides functionality for measuring and displaying time.
package time
// Days of the week.
diff --git a/src/pkg/time/zoneinfo_unix.go b/src/pkg/time/zoneinfo_unix.go
index 6685da747..42659ed60 100644
--- a/src/pkg/time/zoneinfo_unix.go
+++ b/src/pkg/time/zoneinfo_unix.go
@@ -17,8 +17,6 @@ import (
const (
headerSize = 4 + 16 + 4*7
- zoneDir = "/usr/share/zoneinfo/"
- zoneDir2 = "/usr/share/lib/zoneinfo/"
)
// Simple I/O interface to binary blob of data.
@@ -211,16 +209,22 @@ func setupZone() {
// no $TZ means use the system default /etc/localtime.
// $TZ="" means use UTC.
// $TZ="foo" means use /usr/share/zoneinfo/foo.
+ // Many systems use /usr/share/zoneinfo, Solaris 2 has
+ // /usr/share/lib/zoneinfo, IRIX 6 has /usr/lib/locale/TZ.
+ zoneDirs := []string{"/usr/share/zoneinfo/",
+ "/usr/share/lib/zoneinfo/",
+ "/usr/lib/locale/TZ/"}
tz, err := os.Getenverror("TZ")
switch {
case err == os.ENOENV:
zones, _ = readinfofile("/etc/localtime")
case len(tz) > 0:
- var ok bool
- zones, ok = readinfofile(zoneDir + tz)
- if !ok {
- zones, _ = readinfofile(zoneDir2 + tz)
+ for _, zoneDir := range zoneDirs {
+ var ok bool
+ if zones, ok = readinfofile(zoneDir + tz); ok {
+ break
+ }
}
case len(tz) == 0:
// do nothing: use UTC