aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/timestamp.c
diff options
context:
space:
mode:
authorThomas G. Lockhart <lockhart@fourpalms.org>2001-01-17 16:46:56 +0000
committerThomas G. Lockhart <lockhart@fourpalms.org>2001-01-17 16:46:56 +0000
commit8e9840383c94ee9da264b7b29d85cf2ce4866449 (patch)
tree8ebcae7abbf2eb8d55f0073b6c6ef569244c6a94 /src/backend/utils/adt/timestamp.c
parent9a342d2035996720131ff96647f45f76b368ec53 (diff)
downloadpostgresql-8e9840383c94ee9da264b7b29d85cf2ce4866449.tar.gz
postgresql-8e9840383c94ee9da264b7b29d85cf2ce4866449.zip
Change comparisons of tm->tm_isdst from "nonzero" to "greater than zero".
Not sure why some were this way, and others were already correct, but it seems to have been like this for several years. This caused problems on a few damaged platforms like AIX and IRIX which do not support DST calculations for years before 1970. Thanks to Andreas Zeugswetter <ZeugswetterA@wien.spardat.at> for finding the problem.
Diffstat (limited to 'src/backend/utils/adt/timestamp.c')
-rw-r--r--src/backend/utils/adt/timestamp.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/utils/adt/timestamp.c b/src/backend/utils/adt/timestamp.c
index 436eeb5b4da..144aec0cbe7 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.41 2001/01/03 16:48:02 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/timestamp.c,v 1.42 2001/01/17 16:46:56 thomas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -341,9 +341,9 @@ timestamp2tm(Timestamp dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
*tzn = (char *) tm->tm_zone;
# elif defined(HAVE_INT_TIMEZONE)
# ifdef __CYGWIN__
- *tzp = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
+ *tzp = ((tm->tm_isdst > 0) ? (_timezone - 3600) : _timezone);
# else
- *tzp = (tm->tm_isdst ? (timezone - 3600) : timezone);
+ *tzp = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezone);
# endif
if (tzn != NULL)
*tzn = tzname[(tm->tm_isdst > 0)];
@@ -1086,9 +1086,9 @@ timestamp_pl_span(PG_FUNCTION_ARGS)
# elif defined(HAVE_INT_TIMEZONE)
# ifdef __CYGWIN__
- tz = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
+ tz = ((tm->tm_isdst > 0) ? (_timezone - 3600) : _timezone);
# else
- tz = (tm->tm_isdst ? (timezone - 3600) : timezone);
+ tz = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezone);
# endif
# endif
@@ -1735,9 +1735,9 @@ timestamp_trunc(PG_FUNCTION_ARGS)
# elif defined(HAVE_INT_TIMEZONE)
# ifdef __CYGWIN__
- tz = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
+ tz = ((tm->tm_isdst > 0) ? (_timezone - 3600) : _timezone);
# else
- tz = (tm->tm_isdst ? (timezone - 3600) : timezone);
+ tz = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezone);
# endif
# endif