summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKa-Hing Cheung <khc@pidgin.im>2007-09-09 00:46:16 +0000
committerKa-Hing Cheung <khc@pidgin.im>2007-09-09 00:46:16 +0000
commit6dcf1153f68291929240b971866e005a1bf9fd07 (patch)
tree6c034906660b0d18291db5edd0a24ed52eaa67be
parent8ce16a4c4bc86ab3ca659584ef944875924eae84 (diff)
downloadpidgin-6dcf1153f68291929240b971866e005a1bf9fd07.tar.gz
I think this is the right way to fix timezone. People on Win32 _and_
people on system without HAVE_TM_GMTOFF and with HAVE_TIMEZONE need to test this Everyone else test this too, because I didn't References #2990
-rw-r--r--libpurple/protocols/msn/oim.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/libpurple/protocols/msn/oim.c b/libpurple/protocols/msn/oim.c
index b5384c456e..703522560a 100644
--- a/libpurple/protocols/msn/oim.c
+++ b/libpurple/protocols/msn/oim.c
@@ -448,14 +448,32 @@ msn_oim_parse_timestamp(const char *timestamp)
}
if (sscanf(tz_ptr, "%02d%02d", &tzhrs, &tzmins) == 2) {
- t.tm_year -= 1900;
-#if HAVE_TM_GMTOFF
- t.tm_gmtoff = tzhrs * 60 * 60 + tzmins * 60;
- if (!offset_positive)
- t.tm_gmtoff *= -1;
+ time_t tzoff = tzhrs * 60 * 60 + tzmins * 60;
+#ifdef _WIN32
+ long sys_tzoff;
#endif
+
+ if (!offset_positive)
+ tzoff *= -1;
+
+ t.tm_year -= 1900;
t.tm_isdst = 0;
- return mktime(&t);
+
+#ifdef _WIN32
+ if ((sys_tzoff = win32_get_tz_offset()) != -1)
+ tzoff += sys_tzoff;
+#else
+#ifdef HAVE_TM_GMTOFF
+ tzoff += t.tm_gmtoff;
+#else
+# ifdef HAVE_TIMEZONE
+ tzset(); /* making sure */
+ tzoff -= timezone;
+# endif
+#endif
+#endif /* _WIN32 */
+
+ return mktime(&t) + tzoff;
}
}
}