# HG changeset patch # User Ka-Hing Cheung # Date 1189298776 0 # Node ID 6ef43e723595b539d5a53c5806c370caddc90402 # Parent 89a82874d64ecb1022fe76bcef11785b20a49a24 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 diff -r 89a82874d64e -r 6ef43e723595 libpurple/protocols/msn/oim.c --- a/libpurple/protocols/msn/oim.c Sat Sep 08 23:59:25 2007 +0000 +++ b/libpurple/protocols/msn/oim.c Sun Sep 09 00:46:16 2007 +0000 @@ -448,14 +448,32 @@ } 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; + time_t tzoff = tzhrs * 60 * 60 + tzmins * 60; +#ifdef _WIN32 + long sys_tzoff; +#endif + if (!offset_positive) - t.tm_gmtoff *= -1; + tzoff *= -1; + + t.tm_year -= 1900; + t.tm_isdst = 0; + +#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 - t.tm_isdst = 0; - return mktime(&t); +#endif /* _WIN32 */ + + return mktime(&t) + tzoff; } } }