mirror of
https://github.com/golang/go
synced 2024-11-20 09:04:44 -07:00
time: simplify: tell people to not use == with Time values
Change-Id: I49952f89b04f41109bb6591c6f025971d9880123 Reviewed-on: https://go-review.googlesource.com/32411 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: David Symonds <dsymonds@golang.org>
This commit is contained in:
parent
d89ab1398e
commit
2c5bce1cfa
@ -75,7 +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.
|
||||
// Note that using == with Time values produces unpredictable results.
|
||||
// Do not use == with Time values.
|
||||
func (t Time) Equal(u Time) bool {
|
||||
return t.sec == u.sec && t.nsec == u.nsec
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user