Index: src/backend/utils/adt/formatting.c
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/adt/formatting.c,v
retrieving revision 1.127
diff -c -c -r1.127 formatting.c
*** src/backend/utils/adt/formatting.c	17 Feb 2007 01:51:42 -0000	1.127
--- src/backend/utils/adt/formatting.c	17 Feb 2007 03:09:43 -0000
***************
*** 2000,2006 ****
  #ifdef HAVE_INT64_TIMESTAMP
  				sprintf(inout, "%03d", (int) (tmtc->fsec / INT64CONST(1000)));
  #else
! 				sprintf(inout, "%03d", (int) rint(tmtc->fsec * 1000));
  #endif
  				if (S_THth(suf))
  					str_numth(p_inout, inout, S_TH_TYPE(suf));
--- 2000,2007 ----
  #ifdef HAVE_INT64_TIMESTAMP
  				sprintf(inout, "%03d", (int) (tmtc->fsec / INT64CONST(1000)));
  #else
! 				/* No rint() because we can't overflow and we might print US */
! 				sprintf(inout, "%03d", (int) (tmtc->fsec * 1000));
  #endif
  				if (S_THth(suf))
  					str_numth(p_inout, inout, S_TH_TYPE(suf));
***************
*** 2041,2047 ****
  #ifdef HAVE_INT64_TIMESTAMP
  				sprintf(inout, "%06d", (int) tmtc->fsec);
  #else
! 				sprintf(inout, "%06d", (int) rint(tmtc->fsec * 1000000));
  #endif
  				if (S_THth(suf))
  					str_numth(p_inout, inout, S_TH_TYPE(suf));
--- 2042,2049 ----
  #ifdef HAVE_INT64_TIMESTAMP
  				sprintf(inout, "%06d", (int) tmtc->fsec);
  #else
! 				/* don't use rint() because we can't overflow 1000 */
! 				sprintf(inout, "%06d", (int) (tmtc->fsec * 1000000));
  #endif
  				if (S_THth(suf))
  					str_numth(p_inout, inout, S_TH_TYPE(suf));
