Re: [HACKERS] how to add seconds to a TimestampTz

2007-03-20 Thread Alvaro Herrera
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 T

Re: [HACKERS] how to add seconds to a TimestampTz

2007-03-15 Thread Alvaro Herrera
Grzegorz Jaskiewicz wrote: > > On Mar 15, 2007, at 5:58 AM, Tom Lane wrote: > > > > >? I'm not sure what would be the most convenient realization > >of this at the C level, but please stay away from time_t ... > > what's wrong with time_t ? Does postgres has some sort of "time" API, > that ca

Re: [HACKERS] how to add seconds to a TimestampTz

2007-03-15 Thread Sailesh Krishnamurthy
--Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alvaro Herrera Sent: Wednesday, March 14, 2007 3:46 PM To: Hackers Subject: [HACKERS] how to add seconds to a TimestampTz Is there a better way than going to time_t and back? I am currently using this:

Re: [HACKERS] how to add seconds to a TimestampTz

2007-03-15 Thread Grzegorz Jaskiewicz
On Mar 15, 2007, at 5:58 AM, Tom Lane wrote: ? I'm not sure what would be the most convenient realization of this at the C level, but please stay away from time_t ... what's wrong with time_t ? Does postgres has some sort of "time" API, that can be used instead? -- Grzegorz Jaskiewicz

Re: [HACKERS] how to add seconds to a TimestampTz

2007-03-15 Thread Alvaro Herrera
Tom Lane wrote: > Alvaro Herrera <[EMAIL PROTECTED]> writes: > > Is there a better way than going to time_t and back? > > Isn't the standard SQL-level locution > timestamptz + numeric_value * '1 second'::interval > ? I'm not sure what would be the most convenient realization > of this at th

Re: [HACKERS] how to add seconds to a TimestampTz

2007-03-14 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > Is there a better way than going to time_t and back? Isn't the standard SQL-level locution timestamptz + numeric_value * '1 second'::interval ? I'm not sure what would be the most convenient realization of this at the C level, but please stay a

[HACKERS] how to add seconds to a TimestampTz

2007-03-14 Thread Alvaro Herrera
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.