Commit f3fc8b02 authored by Shenghou Ma's avatar Shenghou Ma Committed by Minux Ma

time: document that not all Unix time can be represented

Fixes #10906.

Change-Id: I7ae25a500df493c1e78183d69d89b3e2a64a0d1a
Reviewed-on: https://go-review.googlesource.com/10223Reviewed-by: 's avatarAndrew Gerrand <adg@golang.org>
parent b21ff396
...@@ -966,6 +966,8 @@ func (t *Time) UnmarshalText(data []byte) (err error) { ...@@ -966,6 +966,8 @@ func (t *Time) UnmarshalText(data []byte) (err error) {
// Unix returns the local Time corresponding to the given Unix time, // Unix returns the local Time corresponding to the given Unix time,
// sec seconds and nsec nanoseconds since January 1, 1970 UTC. // sec seconds and nsec nanoseconds since January 1, 1970 UTC.
// It is valid to pass nsec outside the range [0, 999999999]. // 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 { func Unix(sec int64, nsec int64) Time {
if nsec < 0 || nsec >= 1e9 { if nsec < 0 || nsec >= 1e9 {
n := nsec / 1e9 n := nsec / 1e9
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment