fix integer datetime division rounding error
От | Andrew Dunstan |
---|---|
Тема | fix integer datetime division rounding error |
Дата | |
Msg-id | 42E2DF6E.3000208@dunslane.net обсуждение исходный текст |
Ответы |
Re: fix integer datetime division rounding error
|
Список | pgsql-patches |
The attached patch seems to fix the rounding error that is causing regression failures on machines with integer datetimes. (Source of error discovered by Andrew@Supernews).ISTM this code needs to be given some careful analysis - I know it makes my head spin reading it. cheers andrew Index: src/backend/utils/adt/timestamp.c =================================================================== RCS file: /home/cvsmirror/pgsql/src/backend/utils/adt/timestamp.c,v retrieving revision 1.145 diff -c -r1.145 timestamp.c *** src/backend/utils/adt/timestamp.c 23 Jul 2005 14:53:21 -0000 1.145 --- src/backend/utils/adt/timestamp.c 24 Jul 2005 00:04:08 -0000 *************** *** 2319,2325 **** day_remainder += (month_remainder * DAYS_PER_MONTH) - (int)(month_remainder * DAYS_PER_MONTH); #ifdef HAVE_INT64_TIMESTAMP ! result->time += day_remainder * USECS_PER_DAY; #else result->time += day_remainder * SECS_PER_DAY; result->time = JROUND(result->time); --- 2319,2325 ---- day_remainder += (month_remainder * DAYS_PER_MONTH) - (int)(month_remainder * DAYS_PER_MONTH); #ifdef HAVE_INT64_TIMESTAMP ! result->time += rint(day_remainder * USECS_PER_DAY); #else result->time += day_remainder * SECS_PER_DAY; result->time = JROUND(result->time);
В списке pgsql-patches по дате отправления: