2021-05-06 14:54:10 -07:00
|
|
|
begin;
|
|
|
|
|
|
2022-08-08 18:17:57 -04:00
|
|
|
create function wt_add_seconds(sec integer, ts timestamp with time zone) returns timestamp with time zone
|
2021-05-06 14:54:10 -07:00
|
|
|
as $$
|
|
|
|
|
select ts + sec * '1 second'::interval;
|
|
|
|
|
$$ language sql
|
|
|
|
|
stable
|
|
|
|
|
returns null on null input;
|
|
|
|
|
comment on function wt_add_seconds is
|
|
|
|
|
'wt_add_seconds returns ts + sec.';
|
|
|
|
|
|
2022-08-08 18:17:57 -04:00
|
|
|
create function wt_add_seconds_to_now(sec integer) returns timestamp with time zone
|
2021-05-06 14:54:10 -07:00
|
|
|
as $$
|
|
|
|
|
select wt_add_seconds(sec, current_timestamp);
|
|
|
|
|
$$ language sql
|
|
|
|
|
stable
|
|
|
|
|
returns null on null input;
|
|
|
|
|
comment on function wt_add_seconds_to_now is
|
|
|
|
|
'wt_add_seconds_to_now returns current_timestamp + sec.';
|
|
|
|
|
|
|
|
|
|
commit;
|