Index: src/backend/utils/adt/timestamp.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v
retrieving revision 1.146
diff -c -c -r1.146 timestamp.c
*** src/backend/utils/adt/timestamp.c	24 Jul 2005 04:37:07 -0000	1.146
--- src/backend/utils/adt/timestamp.c	30 Jul 2005 18:19:14 -0000
***************
*** 1915,1922 ****
  
  #ifdef HAVE_INT64_TIMESTAMP
  	result->time += span->day * USECS_PER_DAY;
! 	result->day = result->time / USECS_PER_DAY;
! 	result->time -= result->day * USECS_PER_DAY;
  #else
  	result->time += span->day * (double)SECS_PER_DAY;
  	TMODULO(result->time, result->day, (double)SECS_PER_DAY);
--- 1915,1921 ----
  
  #ifdef HAVE_INT64_TIMESTAMP
  	result->time += span->day * USECS_PER_DAY;
! 	TMODULO(result->time, result->day, USECS_PER_DAY);
  #else
  	result->time += span->day * (double)SECS_PER_DAY;
  	TMODULO(result->time, result->day, (double)SECS_PER_DAY);
***************
*** 1939,1952 ****
  	result->day = span->day;
  	result->time = span->time;
  
! #ifdef HAVE_INT64_TIMESTAMP
! 	result->day += span->month * (double)DAYS_PER_MONTH;
! 	result->month = span->day / DAYS_PER_MONTH;
! 	result->day -= result->month * DAYS_PER_MONTH;
! #else
! 	result->day += span->month * (double)DAYS_PER_MONTH;
! 	TMODULO(result->day, result->month, (double)DAYS_PER_MONTH);
! #endif
  
  	PG_RETURN_INTERVAL_P(result);
  }
--- 1938,1945 ----
  	result->day = span->day;
  	result->time = span->time;
  
! 	result->day += span->month * DAYS_PER_MONTH;
! 	TMODULO(result->day, result->month, DAYS_PER_MONTH);
  
  	PG_RETURN_INTERVAL_P(result);
  }
