From: Gustavo Niemeyer Date: Fri, 13 Apr 2012 01:16:31 +0000 (-0300) Subject: time: panic if UnixNano is out of range X-Git-Tag: go1.1rc2~3386 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e4389c1d3058b90fac40bb5bc7578f7e7d580899;p=gostls13.git time: panic if UnixNano is out of range R=golang-dev, remyoudompheng, dsymonds, gustavo, dchest, r, rsc CC=golang-dev https://golang.org/cl/5985059 --- diff --git a/src/pkg/time/time.go b/src/pkg/time/time.go index 473bc2a451..f556166fe6 100644 --- a/src/pkg/time/time.go +++ b/src/pkg/time/time.go @@ -763,7 +763,9 @@ func (t Time) Unix() int64 { } // UnixNano returns t as a Unix time, the number of nanoseconds elapsed -// since January 1, 1970 UTC. +// since January 1, 1970 UTC. The result is undefined if the Unix time +// in nanoseconds cannot be represented by an int64. Note that this +// means the result of calling UnixNano on the zero Time is undefined. func (t Time) UnixNano() int64 { return (t.sec+internalToUnix)*1e9 + int64(t.nsec) }