aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/nabstime.c
diff options
context:
space:
mode:
authorThomas G. Lockhart <lockhart@fourpalms.org>1998-12-31 16:30:59 +0000
committerThomas G. Lockhart <lockhart@fourpalms.org>1998-12-31 16:30:59 +0000
commit4d56dbd678fb84cac66a47421ae06a090d438a99 (patch)
tree3fc6982bbb5441b95de283eee86a1232e38bf4ee /src/backend/utils/adt/nabstime.c
parent2d74bf884396e60f566645d9d3610a75ea768787 (diff)
downloadpostgresql-4d56dbd678fb84cac66a47421ae06a090d438a99.tar.gz
postgresql-4d56dbd678fb84cac66a47421ae06a090d438a99.zip
Change ordering of HAVE_TM_ZONE and HAVE_INT_TIMEZONE code blocks
to give HAVE_TM_ZONE priority. This fixes glibc2 machines and any other machine which passes both tests in configure. Repair HAVE_TM_ZONE code which stuffs tm structure with date type values. Same problems as were originally there before v6.1, but never noticed. Thanks to Oleg for nagging :)
Diffstat (limited to 'src/backend/utils/adt/nabstime.c')
-rw-r--r--src/backend/utils/adt/nabstime.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c
index 95c1442ac31..b6147490be7 100644
--- a/src/backend/utils/adt/nabstime.c
+++ b/src/backend/utils/adt/nabstime.c
@@ -4,7 +4,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
- * $Id: nabstime.c,v 1.50 1998/12/15 15:28:57 scrappy Exp $
+ * $Id: nabstime.c,v 1.51 1998/12/31 16:30:59 thomas Exp $
*
*/
#include <stdio.h>
@@ -57,7 +57,7 @@ GetCurrentAbsoluteTime(void)
if (!HasCTZSet)
{
#ifdef USE_POSIX_TIME
-#ifdef HAVE_TM_ZONE
+#if defined(HAVE_TM_ZONE)
tm = localtime(&now);
CTimeZone = -tm->tm_gmtoff; /* tm_gmtoff is Sun/DEC-ism */
@@ -86,9 +86,8 @@ GetCurrentAbsoluteTime(void)
CTimeZone = tb.timezone * 60;
CDayLight = (tb.dstflag != 0);
- /*
- * XXX does this work to get the local timezone string in V7? -
- * tgl 97/03/18
+ /* XXX does this work to get the local timezone string in V7?
+ * - tgl 97/03/18
*/
strftime(CTZName, MAXTZLEN, "%Z", localtime(&now));
#endif
@@ -136,14 +135,14 @@ abstime2tm(AbsoluteTime time, int *tzp, struct tm * tm, char *tzn)
#endif
#if defined(DATEDEBUG)
-#if (! defined(HAVE_TM_ZONE)) && defined(HAVE_INT_TIMEZONE)
- printf("datetime2tm- (localtime) %d.%02d.%02d %02d:%02d:%02d %s %s dst=%d\n",
- tx->tm_year, tx->tm_mon, tx->tm_mday, tx->tm_hour, tx->tm_min, tx->tm_sec,
- tzname[0], tzname[1], tx->tm_isdst);
-#else
+#if defined(HAVE_TM_ZONE)
printf("datetime2tm- (localtime) %d.%02d.%02d %02d:%02d:%02d %s dst=%d\n",
tx->tm_year, tx->tm_mon, tx->tm_mday, tx->tm_hour, tx->tm_min, tx->tm_sec,
tx->tm_zone, tx->tm_isdst);
+#elif defined(HAVE_INT_TIMEZONE)
+ printf("datetime2tm- (localtime) %d.%02d.%02d %02d:%02d:%02d %s %s dst=%d\n",
+ tx->tm_year, tx->tm_mon, tx->tm_mday, tx->tm_hour, tx->tm_min, tx->tm_sec,
+ tzname[0], tzname[1], tx->tm_isdst);
#endif
#endif
@@ -157,7 +156,7 @@ abstime2tm(AbsoluteTime time, int *tzp, struct tm * tm, char *tzn)
tm->tm_sec = tx->tm_sec;
tm->tm_isdst = tx->tm_isdst;
-#ifdef HAVE_TM_ZONE
+#if defined(HAVE_TM_ZONE)
tm->tm_gmtoff = tx->tm_gmtoff;
tm->tm_zone = tx->tm_zone;
@@ -171,7 +170,7 @@ abstime2tm(AbsoluteTime time, int *tzp, struct tm * tm, char *tzn)
*tzp = (tm->tm_isdst ? (timezone - 3600) : timezone);
if (tzn != NULL)
strcpy(tzn, tzname[tm->tm_isdst]);
-#else /* !HAVE_INT_TIMEZONE */
+#else
#error POSIX time support is broken
#endif
#else /* ! USE_POSIX_TIME */