mirror of
https://github.com/golang/go
synced 2024-11-18 02:54:47 -07:00
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 <iant@golang.org>
This commit is contained in:
parent
4ff45821ae
commit
9bde9b4d15
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user