aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/timestamp.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2005-07-23 14:53:21 +0000
committerBruce Momjian <bruce@momjian.us>2005-07-23 14:53:21 +0000
commitf76f24dfffe6ed8fe40d29d0af9eae6276612491 (patch)
treeb821e96c0f3e63efa56e759799b17b8678492109 /src/backend/utils/adt/timestamp.c
parent3dbbbbf8e98329e1eea9920436defc64af3594d3 (diff)
downloadpostgresql-f76f24dfffe6ed8fe40d29d0af9eae6276612491.tar.gz
postgresql-f76f24dfffe6ed8fe40d29d0af9eae6276612491.zip
Improve computations of interval_div to prevent rounding problem on AIX.
Diffstat (limited to 'src/backend/utils/adt/timestamp.c')
-rw-r--r--src/backend/utils/adt/timestamp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index da7a87a1bb8..ac628453441 100644
--- a/src/backend/utils/adt/timestamp.c
+++ b/src/backend/utils/adt/timestamp.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.144 2005/07/23 14:25:34 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/timestamp.c,v 1.145 2005/07/23 14:53:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2308,9 +2308,9 @@ interval_div(PG_FUNCTION_ARGS)
result->day = span->day / factor;
result->time = span->time / factor;
- /* Computer remainders */
- month_remainder = (span->month - result->month * factor) / factor;
- day_remainder = (span->day - result->day * factor) / factor;
+ /* Compute remainders */
+ month_remainder = span->month / factor - result->month;
+ day_remainder = span->day / factor - result->day;
/* Cascade fractions to lower units */
/* fractional months full days into days */