changeset 2724:9fd2f12fee0a

fix Win32 ngx_gettimezone()
author Igor Sysoev <igor@sysoev.ru>
date Sun, 19 Apr 2009 19:08:49 +0000
parents 53be1d485af9
children d43d73277c5c
files src/os/win32/ngx_time.c
diffstat 1 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/os/win32/ngx_time.c
+++ b/src/os/win32/ngx_time.c
@@ -60,11 +60,23 @@ ngx_libc_gmtime(time_t s, struct tm *tm)
 ngx_int_t
 ngx_gettimezone(void)
 {
+    u_long                 n;
     TIME_ZONE_INFORMATION  tz;
 
-    if (GetTimeZoneInformation(&tz) != TIME_ZONE_ID_INVALID) {
+    n = GetTimeZoneInformation(&tz);
+
+    switch (n) {
+
+    case TIME_ZONE_ID_UNKNOWN:
         return -tz.Bias;
+
+    case TIME_ZONE_ID_STANDARD:
+        return -(tz.Bias + tz.StandardBias);
+
+    case TIME_ZONE_ID_DAYLIGHT:
+        return -(tz.Bias + tz.DaylightBias);
+
+    default: /* TIME_ZONE_ID_INVALID */
+        return 0;
     }
-
-    return 0;
 }