From 764f72dc823edb3f8bdf387501ce4c12dedd2369 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 17 Jul 2003 00:55:37 +0000 Subject: Make EXTRACT(TIMEZONE) and SET/SHOW TIMEZONE follow the SQL convention for the sign of timezone offsets, ie, positive is east from UTC. These were previously out of step with other operations that accept or show timezones, such as I/O of timestamptz values. --- src/backend/utils/adt/timestamp.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/backend/utils/adt/timestamp.c') diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c index 6cf4f3667cf..4ee6e953240 100644 --- a/src/backend/utils/adt/timestamp.c +++ b/src/backend/utils/adt/timestamp.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.85 2003/07/04 18:21:13 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.86 2003/07/17 00:55:37 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -3080,17 +3080,18 @@ timestamptz_part(PG_FUNCTION_ARGS) switch (val) { case DTK_TZ: - result = tz; + result = -tz; break; case DTK_TZ_MINUTE: - result = tz / 60; - TMODULO(result, dummy, 60e0); + result = -tz; + result /= 60; + FMODULO(result, dummy, 60e0); break; case DTK_TZ_HOUR: - dummy = tz; - TMODULO(dummy, result, 3600e0); + dummy = -tz; + FMODULO(dummy, result, 3600e0); break; case DTK_MICROSEC: -- cgit v1.2.3