]> git.kaiwu.me - nginx.git/commitdiff
fix Win32 ngx_gettimezone()
authorIgor Sysoev <igor@sysoev.ru>
Sun, 19 Apr 2009 19:08:49 +0000 (19:08 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Sun, 19 Apr 2009 19:08:49 +0000 (19:08 +0000)
src/os/win32/ngx_time.c

index 39ce63336a1ba3331a0c2784207dca648242faa9..798c14383c9f8ab7c0ed747f50f78a54207a4065 100644 (file)
@@ -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;
-    }
 
-    return 0;
+    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;
+    }
 }