From: Domas TamaĊĦauskas Date: Thu, 10 Oct 2019 18:54:18 +0000 (+0300) Subject: time: document an alternative way of setting the system's time zone X-Git-Tag: go1.14beta1~465 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=9bde9b4d1561ed915904a4f64764076dcfe58419;p=gostls13.git time: document an alternative way of setting the system's time zone User's program was mutating time.Local variable and crashing itself as a consequence. Instead of documenting that time.Local variable should not be mutated, recommended way of setting the system's time zone has been documented. Fixes #34814 Change-Id: I7781189855c3bf2ea979dfa07f86c283eed27091 Reviewed-on: https://go-review.googlesource.com/c/go/+/200457 Reviewed-by: Ian Lance Taylor --- diff --git a/src/time/zoneinfo.go b/src/time/zoneinfo.go index e6cac620fb..558803f24e 100644 --- a/src/time/zoneinfo.go +++ b/src/time/zoneinfo.go @@ -65,6 +65,11 @@ var UTC *Location = &utcLoc var utcLoc = Location{name: "UTC"} // Local represents the system's local time zone. +// On Unix systems, Local consults the TZ environment +// variable to find the time zone to use. No TZ means +// use the system default /etc/localtime. +// TZ="" means use UTC. +// TZ="foo" means use file foo in the system timezone directory. var Local *Location = &localLoc // localLoc is separate so that initLocal can initialize