From 3e45412327a2654a77944249962b3652e6142299 Mon Sep 17 00:00:00 2001 From: Ondřej Surý Date: Mon, 17 Jan 2011 12:40:45 +0100 Subject: Imported Upstream version 2011.01.12 --- src/pkg/time/zoneinfo_unix.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/pkg/time/zoneinfo_unix.go') 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 -- cgit v1.2.3