From another thread and some playing around, I found that this works:
SELECT
CURRENT_TIMESTAMP AS t2,
(t2 - INTERVAL '9999' DAY - INTERVAL '30' DAY + INTERVAL '1.3' SECOND) AS t1,
CAST((CAST(t2 AS DATE) - DATE '1970-01-01') * 86400
+ (EXTRACT(HOUR FROM t2) * 3600)
+ (EXTRACT(MINUTE FROM t2) * 60) AS DECIMAL(18))
+ (EXTRACT(SECOND FROM t2)) AS t2_s,
CAST((CAST(t1 AS DATE) - DATE '1970-01-01') * 86400
+ (EXTRACT(HOUR FROM t1) * 3600)
+ (EXTRACT(MINUTE FROM t1) * 60) AS DECIMAL(18))
+ (EXTRACT(SECOND FROM t1)) AS t1_s,
t2_s - t1_s AS delta_s
From another thread and some playing around, I found that this works:
SELECT
CURRENT_TIMESTAMP AS t2,
(t2 - INTERVAL '9999' DAY - INTERVAL '30' DAY + INTERVAL '1.3' SECOND) AS t1,
CAST((CAST(t2 AS DATE) - DATE '1970-01-01') * 86400
+ (EXTRACT(HOUR FROM t2) * 3600)
+ (EXTRACT(MINUTE FROM t2) * 60) AS DECIMAL(18))
+ (EXTRACT(SECOND FROM t2)) AS t2_s,
CAST((CAST(t1 AS DATE) - DATE '1970-01-01') * 86400
+ (EXTRACT(HOUR FROM t1) * 3600)
+ (EXTRACT(MINUTE FROM t1) * 60) AS DECIMAL(18))
+ (EXTRACT(SECOND FROM t1)) AS t1_s,
t2_s - t1_s AS delta_s