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

BUG #1618: EXTRACTing EPOCH from TIME WITH TIME ZONE is broken

From: "Dennis Vshivkov" <walrus(at)amur(dot)ru>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1618: EXTRACTing EPOCH from TIME WITH TIME ZONE is broken
Date: 2005-04-22 11:27:27
Message-ID: 20050422112727.1D37CF136C@svr2.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-bugs
The following bug has been logged online:

Bug reference:      1618
Logged by:          Dennis Vshivkov
Email address:      walrus(at)amur(dot)ru
PostgreSQL version: 7.4.6, 8.0.1
Operating system:   Debian GNU/Linux, kernel 2.4
Description:        EXTRACTing EPOCH from TIME WITH TIME ZONE is broken
Details: 

SELECT EXTRACT(EPOCH FROM '15:00:00+12'::TIMETZ);
 date_part
-----------
     97200
(1 row)

It should rather have returned 10800.

[8.0.1|src/backend/utils/adt/date.c] timetz_part():
    else if ((type == RESERV) && (val == DTK_EPOCH))
    {
#ifdef HAVE_INT64_TIMESTAMP
        result = ((time->time / 1000000e0) - time->zone);
#else
        result = (time->time - time->zone);
#endif
    }

Time zone component should be added, not subtracted.

Responses

pgsql-bugs by date

Next:From: Ingolf KnopfDate: 2005-04-22 13:21:03
Subject: Patch for Bug#1611
Previous:From: Dennis VshivkovDate: 2005-04-22 11:08:45
Subject: BUG #1617: TIME WITH TIME ZONE comparison is partially broken

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