changeset 10987:a8a7730db73c

[gaim-migrate @ 12824] Fix win32 timezone suckage. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Thu, 09 Jun 2005 04:03:20 +0000
parents ecc0f22db510
children 27f0322f06f7
files src/util.c
diffstat 1 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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 */
 			}
 		}
 	}