Skip to content

Commit 9bde9b4

Browse files
domustianlancetaylor
authored andcommitted
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 <[email protected]>
1 parent 4ff4582 commit 9bde9b4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/time/zoneinfo.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ var UTC *Location = &utcLoc
6565
var utcLoc = Location{name: "UTC"}
6666

6767
// Local represents the system's local time zone.
68+
// On Unix systems, Local consults the TZ environment
69+
// variable to find the time zone to use. No TZ means
70+
// use the system default /etc/localtime.
71+
// TZ="" means use UTC.
72+
// TZ="foo" means use file foo in the system timezone directory.
6873
var Local *Location = &localLoc
6974

7075
// localLoc is separate so that initLocal can initialize

0 commit comments

Comments
 (0)