Commit 023556c0 authored by Ian Lance Taylor's avatar Ian Lance Taylor

time: clarify Equal docs

The docs used to imply that using == would compare Locations, but of
course it just compares Location pointers, which will have unpredictable
results depending on how the pointers are loaded.

Change-Id: I783c1309e476a9616a1c1c290eac713aba3b0b57
Reviewed-on: https://go-review.googlesource.com/32332Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 9575c580
......@@ -75,8 +75,7 @@ func (t Time) Before(u Time) bool {
// Equal reports whether t and u represent the same time instant.
// Two times can be equal even if they are in different locations.
// For example, 6:00 +0200 CEST and 4:00 UTC are Equal.
// This comparison is different from using t == u, which also compares
// the locations.
// Note that using == with Time values produces unpredictable results.
func (t Time) Equal(u Time) bool {
return t.sec == u.sec && t.nsec == u.nsec
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment