Alvaro Herrera wrote: > Is there a better way than going to time_t and back? I am currently > using this: > > db->next_worker = > time_t_to_timestamptz(timestamptz_to_time_t(current_time) + > autovacuum_naptime); > > (db->next_worker is a TimestampTz, as is current_time. > autovacuum_naptime is integer for a number of seconds)
For the archives, I just discovered on timestamp.h this macro to help: avdb->ad_next_worker = TimestampTzPlusMilliseconds(now, naptime_secs * 1000); This is a lot simpler and faster ... -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings