try fix test to avoid timezone dependency

Signed-off-by: Duc Canh Le <duccanh.le@ahrefs.com>
This commit is contained in:
Duc Canh Le 2024-04-29 07:36:25 +00:00
parent 5cb55ca1b6
commit 046ab54d0b
2 changed files with 4 additions and 4 deletions

View File

@ -1,2 +1 @@
1 2023-05-04 22:17:23 0
2 2023-05-04 22:17:23 0
2

View File

@ -2,8 +2,9 @@ DROP TABLE IF EXISTS t;
CREATE TABLE t (id UInt64, ts DateTime) ENGINE = MergeTree() ORDER BY (id, ts) SETTINGS index_granularity = 2;
INSERT INTO t VALUES (1, '2023-05-04 21:17:23') (1, '2023-05-04 22:17:23') (2, '2023-05-04 22:17:23') (2, '2023-05-04 23:17:23');
INSERT INTO t VALUES
(1, toDateTime('2023-05-04 21:17:23', 'UTC')), (1, toDateTime('2023-05-04 22:17:23', 'UTC')), (2, toDateTime('2023-05-04 22:17:23', 'UTC')), (2, toDateTime('2023-05-04 23:17:23', 'UTC'));
SELECT *, abs(toUnixTimestamp(ts) - toUnixTimestamp(1683238643)) AS error FROM t WHERE error < 3600;
SELECT count(abs(toUnixTimestamp(ts, 'UTC') - toUnixTimestamp('2023-05-04 22:17:23', 'UTC')) AS error) FROM t WHERE error < 3600;
DROP TABLE IF EXISTS t;