diff --git a/promql/functions.go b/promql/functions.go index 242220f63..91160a039 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 9b03055ed..28700f2d2 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