summaryrefslogtreecommitdiff
path: root/src/pkg/time/zoneinfo_unix.go
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-01-17 12:40:45 +0100
committerOndřej Surý <ondrej@sury.org>2011-01-17 12:40:45 +0100
commit3e45412327a2654a77944249962b3652e6142299 (patch)
treebc3bf69452afa055423cbe0c5cfa8ca357df6ccf /src/pkg/time/zoneinfo_unix.go
parentc533680039762cacbc37db8dc7eed074c3e497be (diff)
downloadgolang-upstream/2011.01.12.tar.gz
Imported Upstream version 2011.01.12upstream/2011.01.12
Diffstat (limited to 'src/pkg/time/zoneinfo_unix.go')
-rw-r--r--src/pkg/time/zoneinfo_unix.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/pkg/time/zoneinfo_unix.go b/src/pkg/time/zoneinfo_unix.go
index 5a8c94aaf..26c86ab03 100644
--- a/src/pkg/time/zoneinfo_unix.go
+++ b/src/pkg/time/zoneinfo_unix.go
@@ -11,8 +11,8 @@ package time
import (
"io/ioutil"
- "once"
"os"
+ "sync"
)
const (
@@ -203,6 +203,7 @@ func readinfofile(name string) ([]zonetime, bool) {
}
var zones []zonetime
+var onceSetupZone sync.Once
func setupZone() {
// consult $TZ to find the time zone to use.
@@ -223,7 +224,7 @@ func setupZone() {
// Look up the correct time zone (daylight savings or not) for the given unix time, in the current location.
func lookupTimezone(sec int64) (zone string, offset int) {
- once.Do(setupZone)
+ onceSetupZone.Do(setupZone)
if len(zones) == 0 {
return "UTC", 0
}
@@ -251,7 +252,7 @@ func lookupTimezone(sec int64) (zone string, offset int) {
// For a system in Sydney, "EST" and "EDT", though they have
// different meanings than they do in New York.
func lookupByName(name string) (off int, found bool) {
- once.Do(setupZone)
+ onceSetupZone.Do(setupZone)
for _, z := range zones {
if name == z.zone.name {
return z.zone.utcoff, true