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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-bugs by date

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