From: Ian Lance Taylor Date: Fri, 28 Oct 2016 22:25:31 +0000 (-0400) Subject: time: clarify Equal docs X-Git-Tag: go1.8beta1~471 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=023556c07166be15a914d1f828d8c7b20a59a804;p=gostls13.git 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/32332 Reviewed-by: Brad Fitzpatrick --- diff --git a/src/time/time.go b/src/time/time.go index d9e1f645eb..33da9fe341 100644 --- a/src/time/time.go +++ b/src/time/time.go @@ -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 }