Re: [HACKERS] Cygwin32 fix for current - Mailing list pgsql-hackers
From | Tatsuo Ishii |
---|---|
Subject | Re: [HACKERS] Cygwin32 fix for current |
Date | |
Msg-id | 199904260447.NAA19478@srapc451.sra.co.jp Whole thread Raw |
List | pgsql-hackers |
>On Sat, 17 Apr 1999, Tom Lane wrote: > >> >> How about this: do something like this >> #ifdef CYGWIN32 >> #define time_zone _timezone >> #else >> #define time_zone timezone >> #endif >> in the header, and then change the field names to time_zone in the code? > >Erk, I think I like that one less then the other option...at least the >other option the #ifdef for _timezone is pseudo-documented...defining and >usin ga time_zone, IMHO, would confuse the code more... > >In light of the fact that CYGWIN is defining a timezone, but that it isn't >useable, I think that the best solution presented so far is the first >one...just #ifdef the relevant sections of code... I have committed changes originally suggested by Yutaka Tanida <yutaka@marin.or.jp> for win32 support. (I have modified the patch for dt.c a little bit due to the changes made after 6.5b1 released). -- Tatsuo Ishii >--- src/backend/utils/adt/nabstime.c.orig Sun Feb 21 12:49:32 1999 >+++ src/backend/utils/adt/nabstime.c Fri Apr 16 14:34:12 1999 >@@ -77,7 +77,12 @@ > tm = localtime(&now); > > CDayLight = tm->tm_isdst; >- CTimeZone = (tm->tm_isdst ? (timezone - 3600) : timezone); >+ CTimeZone = >+#ifdef __CYGWIN32__ >+ (tm->tm_isdst ? (_timezone - 3600) : _timezone); >+#else >+ (tm->tm_isdst ? (timezone - 3600) : timezone); >+#endif > strcpy(CTZName, tzname[tm->tm_isdst]); > #else > #error USE_POSIX_TIME defined but no time zone available >@@ -167,7 +172,11 @@ > strcpy(tzn, tm->tm_zone); > #elif defined(HAVE_INT_TIMEZONE) > if (tzp != NULL) >+#ifdef __CYGWIN__ >+ *tzp = (tm->tm_isdst ? (_timezone - 3600) : _timezone); >+#else > *tzp = (tm->tm_isdst ? (timezone - 3600) : timezone); >+#endif > if (tzn != NULL) > strcpy(tzn, tzname[tm->tm_isdst]); > #else >--- src/backend/utils/adt/dt.c.orig Sat Mar 20 11:31:45 1999 >+++ src/backend/utils/adt/dt.c Fri Apr 16 14:35:56 1999 >@@ -1476,7 +1476,13 @@ > #if defined(HAVE_TM_ZONE) > tz = -(tm->tm_gmtoff); /* tm_gmtoff is Sun/DEC-ism */ > #elif defined(HAVE_INT_TIMEZONE) >- tz = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezone); >+ >+#ifdef __CYGWIN__ >+ tz = (tm->tm_isdst ? (_timezone - 3600) : _timezone); >+#else >+ tz = (tm->tm_isdst ? (timezone - 3600) : timezone); >+#endif >+ > #else > #error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined > #endif >@@ -2474,7 +2480,11 @@ > if (tzn != NULL) > *tzn = (char *)tm->tm_zone; > #elif defined(HAVE_INT_TIMEZONE) >+#ifdef __CYGWIN__ >+ *tzp = (tm->tm_isdst ? (_timezone - 3600) : _timezone); >+#else > *tzp = (tm->tm_isdst ? (timezone - 3600) : timezone); >+#endif > if (tzn != NULL) > *tzn = tzname[(tm->tm_isdst > 0)]; > #else >@@ -3091,7 +3101,11 @@ > #if defined(HAVE_TM_ZONE) > *tzp = -(tm->tm_gmtoff); /* tm_gmtoff is Sun/DEC-ism */ > #elif defined(HAVE_INT_TIMEZONE) >+#ifdef __CYGWIN__ >+ *tzp = ((tm->tm_isdst > 0) ? (_timezone - 3600) : _timezone); >+#else > *tzp = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezone); >+#endif > #else > #error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined > #endif >--- src/backend/utils/adt/datetime.c.orig Mon Mar 15 01:40:15 1999 >+++ src/backend/utils/adt/datetime.c Fri Apr 16 14:30:17 1999 >@@ -383,7 +383,11 @@ > if (tzn != NULL) > *tzn = (char *)tm->tm_zone; > #elif defined(HAVE_INT_TIMEZONE) >+#ifdef __CYGWIN__ >+ *tzp = (tm->tm_isdst ? (_timezone - 3600) : _timezone); >+#else > *tzp = (tm->tm_isdst ? (timezone - 3600) : timezone); >+#endif > if (tzn != NULL) > *tzn = tzname[(tm->tm_isdst > 0)]; > #else >--- src/include/port/win.h.orig Mon Jan 18 21:43:50 1999 >+++ src/include/port/win.h Sat Apr 17 10:45:24 1999 >@@ -5,3 +5,7 @@ > #ifndef O_DIROPEN > #define O_DIROPEN 0x100000 /* should be in sys/fcntl.h */ > #endif >+ >+#define tzname _tzname /* should be in time.h?*/ >+#define USE_POSIX_TIME >+#define HAVE_INT_TIMEZONE /* has int _timezone */ > >
pgsql-hackers by date: