The attached patch seems to fix the rounding error that is causing regression failures on machines with integer datetimes. (Source of error discovered by [EMAIL PROTECTED]).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);
---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to