Commit 2c5bce1c authored by Ian Lance Taylor's avatar Ian Lance Taylor

time: simplify: tell people to not use == with Time values

Change-Id: I49952f89b04f41109bb6591c6f025971d9880123
Reviewed-on: https://go-review.googlesource.com/32411Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarDavid Symonds <dsymonds@golang.org>
parent d89ab139
...@@ -75,7 +75,7 @@ func (t Time) Before(u Time) bool { ...@@ -75,7 +75,7 @@ func (t Time) Before(u Time) bool {
// Equal reports whether t and u represent the same time instant. // Equal reports whether t and u represent the same time instant.
// Two times can be equal even if they are in different locations. // Two times can be equal even if they are in different locations.
// For example, 6:00 +0200 CEST and 4:00 UTC are Equal. // For example, 6:00 +0200 CEST and 4:00 UTC are Equal.
// Note that using == with Time values produces unpredictable results. // Do not use == with Time values.
func (t Time) Equal(u Time) bool { func (t Time) Equal(u Time) bool {
return t.sec == u.sec && t.nsec == u.nsec 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