Thread: Changing the time on the server

Changing the time on the server

From
"Donald Fraser"
Date:
Could somebody tell me the consequences of setting the date forward in time on the server running PostgreSQL and then at a later date, after some transactions have been committed, setting the date back in time?
 
Thanks in advance,
Donald Fraser

Re: Changing the time on the server

From
"Nikolaus Dilger"
Date:
Donald,

It depends on your application and by how much you
change the time.

If you have a database field that is populated with the
system time when you insert records your application
logic may not work as intended.

Not sure why you would want to play with the system
clock in the first place.  If you use NTP (Network Time
Protocol) your server will always have the exact time.
If your time is off you usually only have to change it
once to the correct time.  And it is good practice to
have the database down if you ever have to set the time
backwards.  E.g. if my system clock would be 15 minutes
to fast, I would keep the database down for at least 15
minutes after chaning the clock back to avoid mismatch
in the timestamps.

Regards,
Nikolaus Dilger

On Fri, 21 Feb 2003, "Donald Fraser" wrote:








Could somebody tell me the consequences
of setting the date forward in time on the server
running PostgreSQL
and then at a later date, after some transactions have
been
committed, setting the date back in time?
 
Thanks in advance,
Donald Fraser

Re: Changing the time on the server

From
Tom Lane
Date:
"Donald Fraser" <demolish@cwgsy.net> writes:
> Could somebody tell me the consequences of setting the date forward in time=
>  on the server running PostgreSQL and then at a later date, after some tran=
> sactions have been committed, setting the date back in time?

AFAIR, Postgres itself couldn't care less.  If your application stores
timestamps into the database, it might get a little confused about which
actions were done in what order ...

            regards, tom lane