Re: roundoff problem in time datatype
От | Dennis Bjorklund |
---|---|
Тема | Re: roundoff problem in time datatype |
Дата | |
Msg-id | Pine.LNX.4.44.0509261552380.28238-100000@zigo.dhs.org обсуждение исходный текст |
Ответ на | Re: roundoff problem in time datatype (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: roundoff problem in time datatype
|
Список | pgsql-hackers |
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
В списке pgsql-hackers по дате отправления: