now() time off

Started by John McCawleyabout 20 years ago7 messagesgeneral
Jump to latest
#1John McCawley
nospam@hardgeus.com

Earlier this week when I logged into my database, I just so happened to
notice that the value for now() was six hours off of the time reported
by the operating system when using the date command from the command
line. How is this possible? I rebooted the server and the problem
magically went away. I am quite certain that I didn't modify anything
in the database that should cause this problem. It turns out that that
the now() time has been off for some time, and resulted in quite a bit
of corrupted data. What exactly should I do in the future to keep this
from happening, or where should I look for clues?

John

#2Scott Marlowe
smarlowe@g2switchworks.com
In reply to: John McCawley (#1)
Re: now() time off

On Wed, 2006-02-22 at 16:36, John McCawley wrote:

Earlier this week when I logged into my database, I just so happened to
notice that the value for now() was six hours off of the time reported
by the operating system when using the date command from the command
line. How is this possible? I rebooted the server and the problem
magically went away. I am quite certain that I didn't modify anything
in the database that should cause this problem. It turns out that that
the now() time has been off for some time, and resulted in quite a bit
of corrupted data. What exactly should I do in the future to keep this
from happening, or where should I look for clues?

Sounds like a time zone issue. I'd start looking there.

#3Jim Nasby
Jim.Nasby@BlueTreble.com
In reply to: Scott Marlowe (#2)
Re: now() time off

On Wed, Feb 22, 2006 at 04:46:35PM -0600, Scott Marlowe wrote:

On Wed, 2006-02-22 at 16:36, John McCawley wrote:

Earlier this week when I logged into my database, I just so happened to
notice that the value for now() was six hours off of the time reported
by the operating system when using the date command from the command
line. How is this possible? I rebooted the server and the problem
magically went away. I am quite certain that I didn't modify anything
in the database that should cause this problem. It turns out that that
the now() time has been off for some time, and resulted in quite a bit
of corrupted data. What exactly should I do in the future to keep this
from happening, or where should I look for clues?

Sounds like a time zone issue. I'd start looking there.

I've been bitten by this before as well. I'd be in favor of adding an
option such that postmaster would refuse to start if TZ was something
other than UTC; I'd much rather that then have a bunch of data get
screwed up...
--
Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

#4Martijn van Oosterhout
kleptog@svana.org
In reply to: Jim Nasby (#3)
Re: now() time off

On Wed, Feb 22, 2006 at 06:35:55PM -0600, Jim C. Nasby wrote:

On Wed, Feb 22, 2006 at 04:46:35PM -0600, Scott Marlowe wrote:

Sounds like a time zone issue. I'd start looking there.

I've been bitten by this before as well. I'd be in favor of adding an
option such that postmaster would refuse to start if TZ was something
other than UTC; I'd much rather that then have a bunch of data get
screwed up...

Alternativly you could just set the "timezone" parameter in the
postgresql configuration...

Have a nice day,
--
Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

Show quoted text

Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
tool for doing 5% of the work and then sitting around waiting for someone
else to do the other 95% so you can sue them.

#5Jim Nasby
Jim.Nasby@BlueTreble.com
In reply to: Martijn van Oosterhout (#4)
Re: now() time off

On Thu, Feb 23, 2006 at 12:41:38PM +0100, Martijn van Oosterhout wrote:

On Wed, Feb 22, 2006 at 06:35:55PM -0600, Jim C. Nasby wrote:

On Wed, Feb 22, 2006 at 04:46:35PM -0600, Scott Marlowe wrote:

Sounds like a time zone issue. I'd start looking there.

I've been bitten by this before as well. I'd be in favor of adding an
option such that postmaster would refuse to start if TZ was something
other than UTC; I'd much rather that then have a bunch of data get
screwed up...

Alternativly you could just set the "timezone" parameter in the
postgresql configuration...

Wow, didn't know that was there... was it added fairly recently or have
I just been blind?
--
Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

#6Michael Fuhr
mike@fuhr.org
In reply to: Jim Nasby (#5)
Re: now() time off

On Thu, Feb 23, 2006 at 04:21:19PM -0600, Jim C. Nasby wrote:

On Thu, Feb 23, 2006 at 12:41:38PM +0100, Martijn van Oosterhout wrote:

Alternativly you could just set the "timezone" parameter in the
postgresql configuration...

Wow, didn't know that was there... was it added fairly recently or have
I just been blind?

http://www.postgresql.org/docs/7.3/interactive/release-7-3.html

"Add configuration variables datestyle and timezone (Tom)"

--
Michael Fuhr

#7Jim Nasby
Jim.Nasby@BlueTreble.com
In reply to: Michael Fuhr (#6)
Re: now() time off

On Thu, Feb 23, 2006 at 03:49:50PM -0700, Michael Fuhr wrote:

On Thu, Feb 23, 2006 at 04:21:19PM -0600, Jim C. Nasby wrote:

On Thu, Feb 23, 2006 at 12:41:38PM +0100, Martijn van Oosterhout wrote:

Alternativly you could just set the "timezone" parameter in the
postgresql configuration...

Wow, didn't know that was there... was it added fairly recently or have
I just been blind?

http://www.postgresql.org/docs/7.3/interactive/release-7-3.html

"Add configuration variables datestyle and timezone (Tom)"

Whew. I started on 7.2, so I have a bit of an excuse. :)
--
Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461