Fix from Yutaka Tanida for Cygwin32 support.
authorTatsuo Ishii
Mon, 26 Apr 1999 04:42:49 +0000 (04:42 +0000)
committerTatsuo Ishii
Mon, 26 Apr 1999 04:42:49 +0000 (04:42 +0000)
src/backend/utils/adt/datetime.c
src/backend/utils/adt/dt.c
src/backend/utils/adt/nabstime.c

index bdc4b589d285fd591c448e3b252af19bfe545944..aad1cec4eb0a0ba46476cf8b41eb72a29255d322 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.31 1999/04/15 02:22:37 thomas Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.32 1999/04/26 04:42:48 ishii Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -360,7 +360,11 @@ date2tm(DateADT dateVal, int *tzp, struct tm *tm, double *fsec, char **tzn)
        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
index 373553ed4c8334679c5fe28b69326844fa3626e1..4ab65561e1c66611969ad02a86f128f6e7ceedfe 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *   $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.68 1999/04/15 02:22:39 thomas Exp $
+ *   $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.69 1999/04/26 04:42:48 ishii Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1451,7 +1451,13 @@ datetime_trunc(text *units, DateTime *datetime)
 #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
@@ -2434,7 +2440,11 @@ datetime2tm(DateTime dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
            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
@@ -3058,7 +3068,13 @@ DecodeDateTime(char **field, int *ftype, int nf,
 #if defined(HAVE_TM_ZONE)
                *tzp = -(tm->tm_gmtoff);    /* tm_gmtoff is Sun/DEC-ism */
 #elif defined(HAVE_INT_TIMEZONE)
-               *tzp = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezone);
+ #ifdef __CYGWIN__
+                       *tzp = ((tm->tm_isdst > 0) ? (_timezone - 3600) : _timez
+one);
+ #else
+                        *tzp = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezon
+e);
+ #endif
 #else
 #error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
 #endif
index 8e3b1463ee8c4f933b9cff46c1e86c03340ec02a..11f70819420b3170128125b5526468612b94a11c 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- *   $Id: nabstime.c,v 1.53 1999/02/21 03:49:32 scrappy Exp $
+ *   $Id: nabstime.c,v 1.54 1999/04/26 04:42:49 ishii Exp $
  *
  */
 #include 
@@ -77,7 +77,12 @@ GetCurrentAbsoluteTime(void)
        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 @@ abstime2tm(AbsoluteTime time, int *tzp, struct tm * tm, char *tzn)
        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