fix time from received timestamp
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 4 Jul 2023 10:00:55 +0000 (12:00 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 4 Jul 2023 10:00:55 +0000 (12:00 +0200)
fix-time.sql [new file with mode: 0644]

diff --git a/fix-time.sql b/fix-time.sql
new file mode 100644 (file)
index 0000000..686d471
--- /dev/null
@@ -0,0 +1,5 @@
+select _id, time,to_timestamp((json->>'received')::int8/1000) as received from eg5120 where to_timestamp((json->>'received')::int8/1000) - time > interval '1 second';
+
+begin;
+
+update eg5120 set time=to_timestamp((json->>'received')::int8/1000) where _id in ( select _id from eg5120 where to_timestamp((json->>'received')::int8/1000) - time > interval '1 second' );