Skip site navigation (1) Skip section navigation (2)

BUG #1757: timestamp 'epoch' is not absolute

From: "Steve Bennett" <S(dot)Bennett(at)lancaster(dot)ac(dot)uk>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1757: timestamp 'epoch' is not absolute
Date: 2005-07-06 21:31:40
Message-ID: 20050706213140.B84EBF0B06@svr2.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      1757
Logged by:          Steve Bennett
Email address:      S(dot)Bennett(at)lancaster(dot)ac(dot)uk
PostgreSQL version: 8.0.3
Operating system:   Linux
Description:        timestamp 'epoch' is not absolute
Details: 

I'm seeing a rather annoying problem converting timestamps between unix and
PostgreSQL. It appears that the timestamp 'epoch' is being interpreted as
relative to the local timezone, rather than being an absolute time.

e.g. I'm in the UK, and at the moment we're in summer time, which is UTC+1.
If I do:
    select date_part('epoch', timestamp 'epoch');
I get:
     date_part
    -----------
         -3600

Whereas if I do:
    select date_part('epoch', timestamp 'epoch' AT TIME ZONE 'UTC');
I get:
     date_part
    -----------
             0
Am I misunderstanding what's going on here?
Is there any circumstance where 'epoch' should vary according to the
timezone that you happen to be in?

Thanks in advance

Steve.

Responses

pgsql-bugs by date

Next:From: Denis VlasenkoDate: 2005-07-07 05:21:38
Subject: Re: BUG #1756: PQexec eats huge amounts of memory
Previous:From: Tom LaneDate: 2005-07-06 14:49:31
Subject: Re: Creating trigger function with argument(s) gets backend crash.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group