Re: patch for datetime.c
От | Joseph Shraibman |
---|---|
Тема | Re: patch for datetime.c |
Дата | |
Msg-id | 3AF31358.EECAFD94@selectacast.net обсуждение исходный текст |
Ответ на | patch for datetime.c (Joseph Shraibman <jks@selectacast.net>) |
Ответы |
Re: patch for datetime.c
|
Список | pgsql-patches |
Tom Lane wrote: > > Joseph Shraibman <jks@selectacast.net> writes: > > [root@d1 ~/postgresql-7.1/src/backend/utils/adt] diff -C 3 > > datetime.c.orig datetime.c > > *** datetime.c.orig Thu May 3 21:16:37 2001 > > --- datetime.c Thu May 3 21:19:51 2001 > > *************** > > *** 2087,2092 **** > > --- 2087,2096 ---- > > > sec = (tm->tm_sec + fsec); > > > + if (sec >= 59.995) > > + sec = 59.99; /* Round down to avoid times like > > 2001-05-03 21:18:60.00-04 */ > > + > > + > > switch (style) > > { > > /* compatible with ISO date formats */ > > This is a horrid solution. Well not horrid, but stopgap. There needed to be soemthing that kept there from being 60 seconds in the output. > > The correct solution is to round the original timestamp to two > fractional digits before it's ever broken down into y/m/d/h/m/s. I was afraid to modify the timestamp object. I didn't know what side affects that might have. And I wasn't sure how to create a timestamp from another timestamp. > > At least if you only want two digits of precision. I think Thomas > has been resisting making that change because he wants to allow > displaying more than two digits, instead. > That was the other thing I considered, but I thought two digits was there because it was standard. > BTW, is there really only one routine with this problem? > Err, sort of. There is another method in the same file that operates on time and appears to have the same bug, but times aren't supposed to have fractional seconds. playpen=# select '5:33:59.999'::time; ?column? ---------- 05:33:59 (1 row) So I'm not sure if that other function is a problem or not. -- Joseph Shraibman jks@selectacast.net Increase signal to noise ratio. http://www.targabot.com
В списке pgsql-patches по дате отправления: