summaryrefslogtreecommitdiff
path: root/src/time
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2014-09-25 10:52:02 -0700
committerRob Pike <r@golang.org>2014-09-25 10:52:02 -0700
commite612ab7982835677432113fab66b39c52e09a75b (patch)
tree5e1c035c08fc427c2b499ae9787a315f7e4b5aa9 /src/time
parent6fb4a1f7d8350b01d6aaf7aa15db68c9f3f02232 (diff)
downloadgo-e612ab7982835677432113fab66b39c52e09a75b.tar.gz
time: make it clear that time.Time values do not compare with ==
LGTM=bradfitz, josharian, adg, rsc R=golang-codereviews, bradfitz, josharian, rsc, adg CC=golang-codereviews https://codereview.appspot.com/141340043
Diffstat (limited to 'src/time')
-rw-r--r--src/time/time.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/time/time.go b/src/time/time.go
index 4f76d79ee..0300e846a 100644
--- a/src/time/time.go
+++ b/src/time/time.go
@@ -31,6 +31,11 @@ import "errors"
// change the instant in time being denoted and therefore does not affect the
// computations described in earlier paragraphs.
//
+// Note that the Go == operator compares not just the time instant but also the
+// Location. Therefore, Time values should not be used as map or database keys
+// without first guaranteeing that the identical Location has been set for all
+// values, which can be achieved through use of the UTC or Local method.
+//
type Time struct {
// sec gives the number of seconds elapsed since
// January 1, year 1 00:00:00 UTC.