Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 89c7369

Browse files
committed
Fix from Yutaka Tanida <yutaka@marin.or.jp> for Cygwin32 support.
1 parent c84ea43 commit 89c7369

File tree

3 files changed

+35
-6
lines changed

3 files changed

+35
-6
lines changed

src/backend/utils/adt/datetime.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.31 1999/04/15 02:22:37 thomas Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/datetime.c,v 1.32 1999/04/26 04:42:48 ishii Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -360,7 +360,11 @@ date2tm(DateADT dateVal, int *tzp, struct tm *tm, double *fsec, char **tzn)
360360
if (tzn != NULL)
361361
*tzn = (char *)tm->tm_zone;
362362
#elif defined(HAVE_INT_TIMEZONE)
363+
#ifdef __CYGWIN__
364+
*tzp = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
365+
#else
363366
*tzp = (tm->tm_isdst ? (timezone - 3600) : timezone);
367+
#endif
364368
if (tzn != NULL)
365369
*tzn = tzname[(tm->tm_isdst > 0)];
366370
#else

src/backend/utils/adt/dt.c

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.68 1999/04/15 02:22:39 thomas Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/dt.c,v 1.69 1999/04/26 04:42:48 ishii Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1451,7 +1451,13 @@ datetime_trunc(text *units, DateTime *datetime)
14511451
#if defined(HAVE_TM_ZONE)
14521452
tz = -(tm->tm_gmtoff); /* tm_gmtoff is Sun/DEC-ism */
14531453
#elif defined(HAVE_INT_TIMEZONE)
1454-
tz = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezone);
1454+
1455+
#ifdef __CYGWIN__
1456+
tz = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
1457+
#else
1458+
tz = (tm->tm_isdst ? (timezone - 3600) : timezone);
1459+
#endif
1460+
14551461
#else
14561462
#error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
14571463
#endif
@@ -2434,7 +2440,11 @@ datetime2tm(DateTime dt, int *tzp, struct tm * tm, double *fsec, char **tzn)
24342440
if (tzn != NULL)
24352441
*tzn = (char *)tm->tm_zone;
24362442
#elif defined(HAVE_INT_TIMEZONE)
2443+
#ifdef __CYGWIN__
2444+
*tzp = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
2445+
#else
24372446
*tzp = (tm->tm_isdst ? (timezone - 3600) : timezone);
2447+
#endif
24382448
if (tzn != NULL)
24392449
*tzn = tzname[(tm->tm_isdst > 0)];
24402450
#else
@@ -3058,7 +3068,13 @@ DecodeDateTime(char **field, int *ftype, int nf,
30583068
#if defined(HAVE_TM_ZONE)
30593069
*tzp = -(tm->tm_gmtoff); /* tm_gmtoff is Sun/DEC-ism */
30603070
#elif defined(HAVE_INT_TIMEZONE)
3061-
*tzp = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezone);
3071+
#ifdef __CYGWIN__
3072+
*tzp = ((tm->tm_isdst > 0) ? (_timezone - 3600) : _timez
3073+
one);
3074+
#else
3075+
*tzp = ((tm->tm_isdst > 0) ? (timezone - 3600) : timezon
3076+
e);
3077+
#endif
30623078
#else
30633079
#error USE_POSIX_TIME is defined but neither HAVE_TM_ZONE or HAVE_INT_TIMEZONE are defined
30643080
#endif

src/backend/utils/adt/nabstime.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Copyright (c) 1994, Regents of the University of California
66
*
7-
* $Id: nabstime.c,v 1.53 1999/02/21 03:49:32 scrappy Exp $
7+
* $Id: nabstime.c,v 1.54 1999/04/26 04:42:49 ishii Exp $
88
*
99
*/
1010
#include <stdio.h>
@@ -77,7 +77,12 @@ GetCurrentAbsoluteTime(void)
7777
tm = localtime(&now);
7878

7979
CDayLight = tm->tm_isdst;
80-
CTimeZone = (tm->tm_isdst ? (timezone - 3600) : timezone);
80+
CTimeZone =
81+
#ifdef __CYGWIN32__
82+
(tm->tm_isdst ? (_timezone - 3600) : _timezone);
83+
#else
84+
(tm->tm_isdst ? (timezone - 3600) : timezone);
85+
#endif
8186
strcpy(CTZName, tzname[tm->tm_isdst]);
8287
#else
8388
#error USE_POSIX_TIME defined but no time zone available
@@ -167,7 +172,11 @@ abstime2tm(AbsoluteTime time, int *tzp, struct tm * tm, char *tzn)
167172
strcpy(tzn, tm->tm_zone);
168173
#elif defined(HAVE_INT_TIMEZONE)
169174
if (tzp != NULL)
175+
#ifdef __CYGWIN__
176+
*tzp = (tm->tm_isdst ? (_timezone - 3600) : _timezone);
177+
#else
170178
*tzp = (tm->tm_isdst ? (timezone - 3600) : timezone);
179+
#endif
171180
if (tzn != NULL)
172181
strcpy(tzn, tzname[tm->tm_isdst]);
173182
#else

0 commit comments

Comments
 (0)