From 4801573b64b34ea929620e948fc36da006f2f966 Mon Sep 17 00:00:00 2001 From: Krasi Georgiev Date: Thu, 8 Feb 2018 13:39:13 +0200 Subject: [PATCH] time() return milliseconds (#3811) --- promql/functions.go | 2 +- promql/testdata/functions.test | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/promql/functions.go b/promql/functions.go index 242220f636..91160a039a 100644 --- a/promql/functions.go +++ b/promql/functions.go @@ -38,7 +38,7 @@ type Function struct { // === time() float64 === func funcTime(ev *evaluator, args Expressions) Value { return Scalar{ - V: float64(ev.Timestamp / 1000), + V: float64(ev.Timestamp) / 1000, T: ev.Timestamp, } } diff --git a/promql/testdata/functions.test b/promql/testdata/functions.test index 9b03055ed8..28700f2d2d 100644 --- a/promql/testdata/functions.test +++ b/promql/testdata/functions.test @@ -434,6 +434,9 @@ clear eval instant at 0m year() {} 1970 +eval instant at 1ms time() + 0.001 + eval instant at 0m year(vector(1136239445)) {} 2006