]> Cypherpunks repositories - gostls13.git/commitdiff
time: clarify Equal docs
authorIan Lance Taylor <iant@golang.org>
Fri, 28 Oct 2016 22:25:31 +0000 (18:25 -0400)
committerIan Lance Taylor <iant@golang.org>
Fri, 28 Oct 2016 22:31:09 +0000 (22:31 +0000)
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 <bradfitz@golang.org>
src/time/time.go

index d9e1f645eb8ec254b6389acb46ae1657a4cceb63..33da9fe3412d8e7c87e9d38a171dab5ab967b11c 100644 (file)
@@ -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
 }