summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian2004-09-08 19:43:12 +0000
committerBruce Momjian2004-09-08 19:43:12 +0000
commit567d3810a480dc2becb4b50b7933aa6eba9b10ca (patch)
treec6805459699bb5ef8791ce8fea2505d64e9ec31d
parent77a3ad1b7c3d42f3ea8e8e1e6ac0b5e7360a0cec (diff)
Use _timezone global on Cygwin instead of timezone.
-rw-r--r--config/c-library.m46
-rwxr-xr-xconfigure4
-rw-r--r--src/include/port.h8
-rw-r--r--src/interfaces/ecpg/pgtypeslib/dt.h8
-rw-r--r--src/timezone/pgtz.c6
5 files changed, 18 insertions, 14 deletions
diff --git a/config/c-library.m4 b/config/c-library.m4
index d772ea9714..1fa11402e1 100644
--- a/config/c-library.m4
+++ b/config/c-library.m4
@@ -10,7 +10,11 @@ AC_DEFUN([PGAC_VAR_INT_TIMEZONE],
[AC_CACHE_CHECK(for int timezone, pgac_cv_var_int_timezone,
[AC_TRY_LINK([#include <time.h>
int res;],
- [res = timezone / 60;],
+ [#ifndef __CYGWIN__
+res = timezone / 60;
+#else
+res = _timezone / 60;
+#endif],
[pgac_cv_var_int_timezone=yes],
[pgac_cv_var_int_timezone=no])])
if test x"$pgac_cv_var_int_timezone" = xyes ; then
diff --git a/configure b/configure
index 9b0dc31343..073e3c467f 100755
--- a/configure
+++ b/configure
@@ -10725,7 +10725,11 @@ int res;
int
main ()
{
+#ifndef __CYGWIN__
res = timezone / 60;
+#else
+res = _timezone / 60;
+#endif
;
return 0;
}
diff --git a/src/include/port.h b/src/include/port.h
index 86664c1d5c..1c85567c60 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -180,6 +180,14 @@ extern int win32_open(const char *, int,...);
#define pclose(a) _pclose(a)
#endif
+/* Global variable holding time zone information. */
+#if !defined(__CYGWIN__)
+#define TIMEZONE_GLOBAL timezone
+#else
+#define TIMEZONE_GLOBAL _timezone
+#define tzname _tzname /* should be in time.h? */
+#endif
+
extern int copydir(char *fromdir, char *todir);
/* Missing rand functions */
diff --git a/src/interfaces/ecpg/pgtypeslib/dt.h b/src/interfaces/ecpg/pgtypeslib/dt.h
index fa74a23f4b..001e0fc4af 100644
--- a/src/interfaces/ecpg/pgtypeslib/dt.h
+++ b/src/interfaces/ecpg/pgtypeslib/dt.h
@@ -216,14 +216,6 @@ do { \
} while(0)
#endif
-/* Global variable holding time zone information. */
-#if !defined(__CYGWIN__) && !defined(WIN32)
-#define TIMEZONE_GLOBAL timezone
-#else
-#define TIMEZONE_GLOBAL _timezone
-#define tzname _tzname /* should be in time.h? */
-#endif
-
/*
* Date/time validation
* Include check for leap year.
diff --git a/src/timezone/pgtz.c b/src/timezone/pgtz.c
index c860f15b26..2dd7320b99 100644
--- a/src/timezone/pgtz.c
+++ b/src/timezone/pgtz.c
@@ -96,11 +96,7 @@ get_timezone_offset(struct tm * tm)
#if defined(HAVE_STRUCT_TM_TM_ZONE)
return tm->tm_gmtoff;
#elif defined(HAVE_INT_TIMEZONE)
-#ifdef HAVE_UNDERSCORE_TIMEZONE
- return -_timezone;
-#else
- return -timezone;
-#endif
+ return -TIMEZONE_GLOBAL;
#else
#error No way to determine TZ? Can this happen?
#endif