## Re: roundoff problem in time datatype

From: Dennis Bjorklund Tom Lane Dave Cramer , Re: roundoff problem in time datatype 2005-09-26 14:16:09 Pine.LNX.4.44.0509261552380.28238-100000@zigo.dhs.org (view raw or whole thread) 2005-09-25 17:26:25 from Tom Lane  2005-09-26 07:39:38 from Dennis Bjorklund   2005-09-26 12:58:54 from Dave Cramer    2005-09-26 13:15:14 from Tom Lane     2005-09-26 14:16:09 from Dennis Bjorklund      2005-09-26 14:28:31 from Tom Lane       2005-09-26 14:40:03 from Dennis Bjorklund        2005-09-26 15:49:40 from Tom Lane         2005-09-26 16:22:17 from Dennis Bjorklund         2005-09-26 16:23:06 from Andreas Pflug          2005-09-26 17:00:21 from Tom Lane           2005-09-26 17:21:21 from Andreas Pflug          2005-09-30 22:27:06 from "Jim C(dot) Nasby"       2005-09-26 15:04:13 from Greg Stark       2005-09-26 16:13:58 from Gaetano Mendola   2005-09-26 15:16:41 from Jochem van Dieten    2005-09-26 15:46:47 from Tom Lane     2005-09-30 22:29:25 from "Jim C(dot) Nasby"  2005-10-13 20:48:01 from Bruce Momjian   2005-10-13 20:53:16 from Tom Lane    2005-10-13 20:53:55 from Bruce Momjian     2005-10-13 21:04:47 from Tom Lane    2005-10-13 21:19:01 from Josh Berkus     2005-11-04 21:15:59 from Gurjeet Singh  2005-10-14 02:54:30 from Bruce Momjian   2005-10-14 02:59:26 from Tom Lane   2005-10-16 00:13:32 from Neil Conway    2005-10-16 15:50:09 from Bruce Momjian  2005-10-14 11:48:20 from Bruce Momjian pgsql-hackerspgsql-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

--
/Dennis Björklund

```

### pgsql-hackers by date

 Next: From: Tom Lane Date: 2005-09-26 14:28:31 Subject: Re: roundoff problem in time datatype Previous: From: Alvaro Herrera Date: 2005-09-26 14:08:35 Subject: Re: "expected authentication request from server, but

### pgsql-patches by date

 Next: From: Tom Lane Date: 2005-09-26 14:28:31 Subject: Re: roundoff problem in time datatype Previous: From: Tom Lane Date: 2005-09-26 13:15:14 Subject: Re: roundoff problem in time datatype