From 2bc92cbab7a6af4b5a49c6402fbc000a87ad0382 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 13 Apr 2022 12:23:52 +0200 Subject: [PATCH] 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. --- pkg/utils/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index 3f289080..c83e1420 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -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.