src/util.c

changeset 10987
50b656536923
parent 10948
3a55085a2f33
child 11127
5e539d9d26a4
--- a/src/util.c	Thu Jun 09 03:58:58 2005 +0000
+++ b/src/util.c	Thu Jun 09 04:03:20 2005 +0000
@@ -556,6 +556,17 @@
 			t->tm_isdst = -1;
 
 			if (tzoff || utc) {
+#ifdef _WIN32
+				TIME_ZONE_INFORMATION tzi;
+				DWORD ret;
+				if ((ret = GetTimeZoneInformation(&tzi))
+						!= TIME_ZONE_ID_INVALID) {
+					tzoff -= tzi.Bias * 60;
+					if (ret == TIME_ZONE_ID_DAYLIGHT) {
+						tzoff -= tzi.DaylightBias * 60;
+					}
+				}
+#else
 #ifdef HAVE_TM_GMTOFF
 				tzoff += t->tm_gmtoff;
 #else
@@ -565,6 +576,7 @@
 				t->tm_isdst = 0; /* I think this might fix it */
 #	endif
 #endif
+#endif /* _WIN32 */
 			}
 		}
 	}

mercurial