nginx-0.0.7-2004-06-17-21:18:53 import
diff --git a/src/core/ngx_core.h b/src/core/ngx_core.h
index 55c4147..2a112dd 100644
--- a/src/core/ngx_core.h
+++ b/src/core/ngx_core.h
@@ -19,6 +19,7 @@
 #include <ngx_time.h>
 #include <ngx_socket.h>
 #include <ngx_errno.h>
+#include <ngx_shared.h>
 #include <ngx_process.h>
 #include <ngx_thread.h>
 #include <ngx_user.h>
diff --git a/src/core/ngx_times.c b/src/core/ngx_times.c
index ac2a3a9..aa461c5 100644
--- a/src/core/ngx_times.c
+++ b/src/core/ngx_times.c
@@ -123,15 +123,20 @@
     ngx_cached_http_time.data = p;
 
 
-#if (HAVE_TIMEZONE)
+#if (HAVE_GETTIMEZONE)
 
-    ngx_gmtoff = ngx_timezone();
+    ngx_gmtoff = ngx_gettimezone();
     ngx_gmtime(ngx_cached_time + ngx_gmtoff * 60, &tm);
 
+#elif (HAVE_GMTOFF)
+
+    ngx_localtime(&tm);
+    ngx_gmtoff = tm.ngx_tm_gmtoff / 60;
+
 #else
 
     ngx_localtime(&tm);
-    ngx_gmtoff = tm.ngx_tm_gmtoff / 60;
+    ngx_gmtoff = ngx_timezone(tm.ngx_tm_isdst);
 
 #endif