Re: BUG #1993: Adding/subtracting negative time intervals - Mailing list pgsql-bugs

From Andrew - Supernews
Subject Re: BUG #1993: Adding/subtracting negative time intervals
Date
Msg-id slrndluc99.g61.andrew+nonews@trinity.supernews.net
Whole thread Raw
In response to Re: BUG #1993: Adding/subtracting negative time intervals  (Klint Gore <kg@kgb.une.edu.au>)
List pgsql-bugs
On 2005-10-26, Klint Gore <kg@kgb.une.edu.au> wrote:
> [sorry about the previous email, I quoted the wrong bit and clicked the
> wrong button]
>
> On Tue, 25 Oct 2005 23:41:54 -0400 (EDT), Bruce Momjian
><pgman@candle.pha.pa.us> wrote:
>>     test=> select
>>     test-> ('2005-10-30 13:22:00-05'::timestamptz -
>>     test(>  '2005-10-29 13:22:00-04'::timestamptz);
>>      ?column?
>>     ----------
>>      25:00:00
>>     (1 row)
>
> Is that actually the correct answer?

Absolutely.

> Disregarding daylight savings, there is 25hrs between them.  Once
> daylight savings is taken into account there should be 24 or 26 hours
> between them (southern/northern hemisphere respectively).
>
> Or have I missed something obvious?

Yes. The difference between those two times is exactly the same whatever
timezone the person running the query is in, because they are _completely
specified_ by the input. That difference is 25 hours. There are no
circumstances in which that difference could ever be 24 or 26 hours
regardless of what timezone the user is in. (The only way in which the
timezone makes a difference is that a user in US/Eastern might, under
some circumstances, wish to regard that time period as '1 day' rather
than 25 hours; no user in any other timezone would do so. Since the
conversion from '25 hours' to '1 day' loses information, it should not
happen.)

--
Andrew, Supernews
http://www.supernews.com - individual and corporate NNTP services

pgsql-bugs by date:

Previous
From: Andrew - Supernews
Date:
Subject: Re: BUG #1993: Adding/subtracting negative time intervals
Next
From: Bruce Momjian
Date:
Subject: Re: BUG #1993: Adding/subtracting negative time intervals