Mercurial > pidgin.yaz
changeset 13426:47e51939c923
[gaim-migrate @ 15801]
clean up a little bit
committer: Tailor Script <tailor@pidgin.im>
author | Daniel Atallah <daniel.atallah@gmail.com> |
---|---|
date | Tue, 07 Mar 2006 04:40:16 +0000 |
parents | 95cc25e78ef6 |
children | e3717f0d24ad |
files | src/util.c |
diffstat | 1 files changed, 20 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/util.c Tue Mar 07 04:26:44 2006 +0000 +++ b/src/util.c Tue Mar 07 04:40:16 2006 +0000 @@ -485,6 +485,23 @@ * 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 + #ifndef HAVE_STRFTIME_Z_FORMAT static const char *get_tmoff(const struct tm *tm) { @@ -500,16 +517,8 @@ g_return_val_if_reached(""); #ifdef _WIN32 - TIME_ZONE_INFORMATION tzi; - DWORD ret; - if ((ret = GetTimeZoneInformation(&tzi)) != TIME_ZONE_ID_INVALID) - { - off = -(tzi.Bias * 60); - if (ret == TIME_ZONE_ID_DAYLIGHT) - off -= tzi.DaylightBias * 60; - } - else - return ""; + if ((off = win32_get_tz_offset()) == -1) + return ""; #else # ifdef HAVE_TM_GMTOFF off = new_tm.tm_gmtoff; @@ -798,17 +807,7 @@ #endif #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 + if ((tzoff = win32_get_tz_offset()) == -1) tzoff = GAIM_NO_TZ_OFF; #else #ifdef HAVE_TM_GMTOFF