Re: more timeofday() and "set time zone" weirdness - Mailing list pgsql-general

From Tom Lane
Subject Re: more timeofday() and "set time zone" weirdness
Date
Msg-id 10820.1060805655@sss.pgh.pa.us
Whole thread Raw
In response to more timeofday() and "set time zone" weirdness  (jason_priebe@yahoo.com (Jason Priebe))
Responses Re: more timeofday() and "set time zone" weirdness  (<jason_priebe@yahoo.com>)
List pgsql-general
jason_priebe@yahoo.com (Jason Priebe) writes:
> foo=> select cast(timeofday() as timestamp with time zone); set time
> zone 'GMT+4'; select cast(timeofday() as timestamp with time zone);

This breaks because localtime() is broken: it returns the string "GMT"
as the time zone.  You can see the problem without any reference to
Postgres:

$ date
Wed Aug 13 16:09:56 EDT 2003
$ TZ='GMT+4' date
Wed Aug 13 16:09:57 GMT 2003
$

My advice: don't specify the time zone like that.  Use 'EST5EDT' or some
other standard timezone specifier.  Or avoid timeofday() ... now() or
current_timestamp would be better choices anyway ...

            regards, tom lane

pgsql-general by date:

Previous
From: Jason Godden
Date:
Subject: Re: The database is very slow !
Next
From: "scott.marlowe"
Date:
Subject: Re: Commercial support?