]> Cypherpunks repositories - gostls13.git/commitdiff
time: document that not all Unix time can be represented
authorShenghou Ma <minux@golang.org>
Tue, 19 May 2015 04:25:47 +0000 (00:25 -0400)
committerMinux Ma <minux@golang.org>
Tue, 19 May 2015 06:19:33 +0000 (06:19 +0000)
Fixes #10906.

Change-Id: I7ae25a500df493c1e78183d69d89b3e2a64a0d1a
Reviewed-on: https://go-review.googlesource.com/10223
Reviewed-by: Andrew Gerrand <adg@golang.org>
src/time/time.go

index 0300e846a4b142970d9123cbe567524594747c7b..fbf3f8d3c8ccc7f016756871209d6e33064a8bf7 100644 (file)
@@ -966,6 +966,8 @@ func (t *Time) UnmarshalText(data []byte) (err error) {
 // Unix returns the local Time corresponding to the given Unix time,
 // sec seconds and nsec nanoseconds since January 1, 1970 UTC.
 // It is valid to pass nsec outside the range [0, 999999999].
+// Not all sec values have a corresponding time value. Notable such
+// values are -1<<63 and 1<<63-1.
 func Unix(sec int64, nsec int64) Time {
        if nsec < 0 || nsec >= 1e9 {
                n := nsec / 1e9