golang中time的UnixNano

该函数是在采用随机数的时候发现的,简单来说Unix time指的是从1970年1月1日0时0分0秒起至现在,Nano指的是纳秒

// UnixNano returns t as a Unix time, the number of nanoseconds elapsed
// since January 1, 1970 UTC. The result is undefined if the Unix time
// in nanoseconds cannot be represented by an int64 (a date before the year
// 1678 or after 2262). Note that this means the result of calling UnixNano
// on the zero Time is undefined.
func (t Time) UnixNano() int64 {
    return (t.unixSec())*1e9 + int64(t.nsec())
}

results matching ""

    No results matching ""