]> Cypherpunks repositories - gostls13.git/commit
time: be consistent about representation of UTC location in Time struct
authorRuss Cox <rsc@golang.org>
Mon, 17 Oct 2016 19:47:18 +0000 (15:47 -0400)
committerRuss Cox <rsc@golang.org>
Tue, 18 Oct 2016 12:42:46 +0000 (12:42 +0000)
commit5fbf35dc3fadd29785739fcec061d42157ea7861
treec97c7226b3f9f63d2000753aec38de72521dc3d6
parent79c036238d83c8fceb49aa4bab4d6dade1c321f6
time: be consistent about representation of UTC location in Time struct

In the zero Time, the (not user visible) nil *Location indicates UTC.
In the result of t.UTC() and other ways to create times in specific
zones, UTC is indicated by a non-nil *Location, specifically &utcLoc.
This creates a representation ambiguity exposed by comparison with ==
or reflect.DeepEqual or the like.

Change time.Time representation to use only nil, never &utcLoc,
to represent UTC. This eliminates the ambiguity.

Fixes #15716.

Change-Id: I7dcc2c20ce6b073e1daae323d3e49d17d1d52802
Reviewed-on: https://go-review.googlesource.com/31144
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/time/format.go
src/time/time.go
src/time/time_test.go