]> Cypherpunks repositories - gostls13.git/commitdiff
time: document an alternative way of setting the system's time zone
authorDomas TamaĊĦauskas <puerdomus@gmail.com>
Thu, 10 Oct 2019 18:54:18 +0000 (21:54 +0300)
committerIan Lance Taylor <iant@golang.org>
Fri, 1 Nov 2019 21:41:41 +0000 (21:41 +0000)
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 <iant@golang.org>
src/time/zoneinfo.go

index e6cac620fb352b0702d1cc4d39d99746efbc452b..558803f24ed3d0a29682e6d7e589c9825c76413b 100644 (file)
@@ -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