UnixMilli(x): don't overflow on 4/11/2262 (UTC)

but on 8/17/292278994 by not converting x into int64 ns and those to ms.
This commit is contained in:
Alexander A. Klimov 2022-04-13 12:23:52 +02:00
parent e0859c55a0
commit 2bc92cbab7

View file

@ -27,7 +27,7 @@ func FromUnixMilli(ms int64) time.Time {
// UnixMilli returns milliseconds since the Unix epoch of time t.
func UnixMilli(t time.Time) int64 {
return t.UnixNano() / 1e6
return t.UnixMilli()
}
// Name returns the declared name of type t.