summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/datetime.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/datetime.c')
-rw-r--r--src/backend/utils/adt/datetime.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 186522148d..6f0f5ce986 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.208 2009/06/11 14:49:03 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.209 2009/08/18 21:23:14 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2986,6 +2986,9 @@ DecodeInterval(char **field, int *ftype, int nf, int range,
break;
case DTK_MILLISEC:
+ /* avoid overflowing the fsec field */
+ tm->tm_sec += val / 1000;
+ val -= (val / 1000) * 1000;
#ifdef HAVE_INT64_TIMESTAMP
*fsec += rint((val + fval) * 1000);
#else