From 26ab25b7c0f91169d772c4d439c52133139dcbd4 Mon Sep 17 00:00:00 2001 From: Sven Klemm <31455525+svenklemm@users.noreply.github.com> Date: Wed, 15 Nov 2017 14:50:32 +0100 Subject: [PATCH] dont loose subsecond precision when dealing with timestamp or (#9851) timestamptz --- pkg/tsdb/postgres/postgres.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/tsdb/postgres/postgres.go b/pkg/tsdb/postgres/postgres.go index c1cd95e2e46..dcb60977edc 100644 --- a/pkg/tsdb/postgres/postgres.go +++ b/pkg/tsdb/postgres/postgres.go @@ -187,7 +187,7 @@ func (e PostgresQueryEndpoint) transformToTimeSeries(query *tsdb.Query, rows *co case float64: timestamp = columnValue * 1000 case time.Time: - timestamp = float64(columnValue.Unix() * 1000) + timestamp = float64(columnValue.UnixNano() / 1e6) default: return fmt.Errorf("Invalid type for column time, must be of type timestamp or unix timestamp") }