Re: timezone() with timeofday() converts the wrongdirection?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Steve - DND <postgres(at)digitalnothing(dot)com>
Cc: Scott Marlowe <smarlowe(at)g2switchworks(dot)com>, postgres-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: timezone() with timeofday() converts the wrongdirection?
Date: 2005-04-21 23:52:10
Message-ID: 200504212352.j3LNqA214545@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Steve - DND wrote:
> >
> > What version of PostgreSQL are you running? I seem to remember a few
> > versions ago the offset having the wrong sign.
>
> I'm running 8.0.2 Win32.

BSD Unix looks strange too:

test=> select current_timestamp;
timestamptz
-------------------------------
2005-04-21 19:45:55.553635-04
(1 row)

test=> SELECT timezone('UTC', current_timestamp::timestamp);
timezone
-------------------------------
2005-04-21 15:46:12.740201-04
(1 row)

test=> SELECT timezone('UTC', current_timestamp::timestamp)::timestamp
without time zone;
timezone
----------------------------
2005-04-21 15:46:14.333257
(1 row)

But these look fine:

test=> SELECT timezone('UTC', current_timestamp);
timezone
---------------------------
2005-04-21 23:48:18.60604
(1 row)

test=> SELECT current_timestamp::timestamp;
timestamp
----------------------------
2005-04-21 19:51:25.867765
(1 row)

test=> SELECT current_timestamp::timestamp with time zone;
timestamptz
-------------------------------
2005-04-21 19:51:30.178186-04
(1 row)

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Typing80wpm 2005-04-22 00:28:17 psqlodbc MSAccess and Postgresql
Previous Message Typing80wpm 2005-04-21 23:33:07 listing all tables