# HG changeset patch # User Ka-Hing Cheung # Date 1189575419 0 # Node ID 9058918557103620a7f2d1d21ad2143f2ac20f32 # Parent b5a2938b4549db8a7add21cf0ac07c369a78e65c 3rd time the charm? Fixes #2990, maybe diff -r b5a2938b4549 -r 905891855710 libpurple/protocols/msn/oim.c --- a/libpurple/protocols/msn/oim.c Wed Sep 12 02:40:56 2007 +0000 +++ b/libpurple/protocols/msn/oim.c Wed Sep 12 05:36:59 2007 +0000 @@ -467,7 +467,7 @@ t.tm_isdst = 0; #ifdef _WIN32 - if ((sys_tzoff = win32_get_tz_offset()) != -1) + if ((sys_tzoff = wpurple_get_tz_offset()) != -1) tzoff += sys_tzoff; #else #ifdef HAVE_TM_GMTOFF diff -r b5a2938b4549 -r 905891855710 libpurple/util.c --- a/libpurple/util.c Wed Sep 12 02:40:56 2007 +0000 +++ b/libpurple/util.c Wed Sep 12 05:36:59 2007 +0000 @@ -514,23 +514,6 @@ * Date/Time Functions **************************************************************************/ -#ifdef _WIN32 -static long win32_get_tz_offset() { - TIME_ZONE_INFORMATION tzi; - DWORD ret; - long off = -1; - - if ((ret = GetTimeZoneInformation(&tzi)) != TIME_ZONE_ID_INVALID) - { - off = -(tzi.Bias * 60); - if (ret == TIME_ZONE_ID_DAYLIGHT) - off -= tzi.DaylightBias * 60; - } - - return off; -} -#endif - const char *purple_get_tzoff_str(const struct tm *tm, gboolean iso) { static char buf[7]; @@ -545,7 +528,7 @@ g_return_val_if_reached(""); #ifdef _WIN32 - if ((off = win32_get_tz_offset()) == -1) + if ((off = wpurple_get_tz_offset()) == -1) return ""; #else # ifdef HAVE_TM_GMTOFF @@ -853,7 +836,7 @@ #endif #ifdef _WIN32 - if ((sys_tzoff = win32_get_tz_offset()) == -1) + if ((sys_tzoff = wpurple_get_tz_offset()) == -1) tzoff = PURPLE_NO_TZ_OFF; else tzoff += sys_tzoff; diff -r b5a2938b4549 -r 905891855710 libpurple/win32/win32dep.c --- a/libpurple/win32/win32dep.c Wed Sep 12 02:40:56 2007 +0000 +++ b/libpurple/win32/win32dep.c Wed Sep 12 05:36:59 2007 +0000 @@ -586,6 +586,22 @@ libpurpledll_hInstance = NULL; } +long +wpurple_get_tz_offset() { + TIME_ZONE_INFORMATION tzi; + DWORD ret; + long off = -1; + + if ((ret = GetTimeZoneInformation(&tzi)) != TIME_ZONE_ID_INVALID) + { + off = -(tzi.Bias * 60); + if (ret == TIME_ZONE_ID_DAYLIGHT) + off -= tzi.DaylightBias * 60; + } + + return off; +} + /* DLL initializer */ /* suppress gcc "no previous prototype" warning */ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved); diff -r b5a2938b4549 -r 905891855710 libpurple/win32/win32dep.h --- a/libpurple/win32/win32dep.h Wed Sep 12 02:40:56 2007 +0000 +++ b/libpurple/win32/win32dep.h Wed Sep 12 05:36:59 2007 +0000 @@ -60,6 +60,7 @@ void wpurple_init(void); void wpurple_cleanup(void); +long wpurple_get_tz_offset(void); /* * MACROS