summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas G. Lockhart <lockhart@fourpalms.org>2002-03-15 23:37:48 +0000
committerThomas G. Lockhart <lockhart@fourpalms.org>2002-03-15 23:37:48 +0000
commitefec53adb3a35b5ebbff3f12a0063685c1cd3e09 (patch)
tree772fefcb44164b6095f15ddc0a431ef487b9bd90 /src
parent94a41d132631f31646b81e3307c3c8d28682a4e9 (diff)
Repair bad calculation in timetz_izone() which gave erroneous results.
Will be patched separately but equivalently in HEAD for 7.3.
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/adt/date.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/backend/utils/adt/date.c b/src/backend/utils/adt/date.c
index 044c310fbe1..eed04217d69 100644
--- a/src/backend/utils/adt/date.c
+++ b/src/backend/utils/adt/date.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.64 2001/11/21 05:57:33 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/date.c,v 1.64.2.1 2002/03/15 23:37:48 thomas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1622,7 +1622,6 @@ timetz_izone(PG_FUNCTION_ARGS)
Interval *zone = PG_GETARG_INTERVAL_P(0);
TimeTzADT *time = PG_GETARG_TIMETZADT_P(1);
TimeTzADT *result;
- TimeADT time1;
int tz;
if (zone->month != 0)
@@ -1634,10 +1633,12 @@ timetz_izone(PG_FUNCTION_ARGS)
result = (TimeTzADT *) palloc(sizeof(TimeTzADT));
- time1 = time->time - time->zone + tz;
- TMODULO(result->time, time1, 86400e0);
- if (result->time < 0)
+ result->time = (time->time + (time->zone - tz));
+ while (result->time < 0)
result->time += 86400;
+ while (result->time >= 86400)
+ result->time -= 86400;
+
result->zone = tz;
PG_RETURN_TIMETZADT_P(result);