From: | Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Dave Cramer <pg(at)fastcrypt(dot)com>, <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: roundoff problem in time datatype |
Date: | 2005-09-26 14:16:09 |
Message-ID: | Pine.LNX.4.44.0509261552380.28238-100000@zigo.dhs.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
On Mon, 26 Sep 2005, Tom Lane wrote:
> > Actually, I think there is a case where 24:00 is a proper time. Isn't
> > it used for adding leap seconds ?
>
> No, I think the usual notation for a leap-second is '23:59:60'.
> We do allow 60 in the seconds field for this purpose.
Yes, and it can go up to 23:59:60.999999 (depending on how many fractional
seconds one want).
> I suppose there's another possible approach, which is to special-case
> the output of this value to look like '23:59:60' instead of '24:00:00'.
You would get the same problem with 23:59:60.9 which I guess you want to
round up.
One "solution" is to round '23:59:59.9'::time(0) up to '00:00:00'. That is
normally the next following time value after all. I know why you might not
want to round it "up" to 00:00:00, but it's one logical solution.
By the way, here is another example of the same problem:
# SELECT time '23:59:59.9' + interval '0.1';
?column?
----------
24:00:00
# SELECT time '23:59:59.9' + interval '0.11';
?column?
-------------
00:00:00.01
(1 rad)
--
/Dennis Björklund
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-09-26 14:28:31 | Re: roundoff problem in time datatype |
Previous Message | Alvaro Herrera | 2005-09-26 14:08:35 | Re: "expected authentication request from server, but |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-09-26 14:28:31 | Re: roundoff problem in time datatype |
Previous Message | Tom Lane | 2005-09-26 13:15:14 | Re: roundoff problem in time datatype |