diff --git a/config/c-library.m4 b/config/c-library.m4
index 6385ab36d419102cce51934fbf4c78a9ce7418ee..96e7e18b15813b1185ae16eebd90a4dfbf45cea0 100644
--- a/config/c-library.m4
+++ b/config/c-library.m4
@@ -1,5 +1,5 @@
 # Macros that test various C library quirks
-# $PostgreSQL: pgsql/config/c-library.m4,v 1.26 2004/06/07 22:39:44 momjian Exp $
+# $PostgreSQL: pgsql/config/c-library.m4,v 1.27 2004/09/08 19:43:00 momjian Exp $
 
 
 # PGAC_VAR_INT_TIMEZONE
@@ -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 9b0dc313434974cf53e6b0eacc25dd65d965229f..073e3c467fa3f384b5b082a2ab343ffb6e9eae2e 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 e3e4eda45691503cb1018a7c3ef35e64064f4b93..080026e1c89d7faa321df216421d3f8a6b904433 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $PostgreSQL: pgsql/src/include/port.h,v 1.57 2004/08/29 21:08:48 tgl Exp $
+ * $PostgreSQL: pgsql/src/include/port.h,v 1.58 2004/09/08 19:43:07 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -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 fa74a23f4ba180738f0c7ce401e4f3387a8a9c5f..001e0fc4af45b1031a2167aa46f8c3839cdbc11d 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 f12b025e92d8c5f5f42bf805d2311550c9614c7d..e8b0fe75f88d6911ec93e0e380bac75a38507cdd 100644
--- a/src/timezone/pgtz.c
+++ b/src/timezone/pgtz.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.27 2004/09/02 01:15:06 momjian Exp $
+ *	  $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.28 2004/09/08 19:43:12 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -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