Mercurial > pidgin.yaz
comparison libpurple/util.c @ 20511:bced1f19cb1d
explicit merge of '996cf0c57149ba6e1c714ebb1f11d5d4bac8fb68'
and 'a50b5c8c98f4e121b414810d37417458e919de79'
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Sun, 16 Sep 2007 18:01:18 +0000 |
parents | b77adb803eca |
children | f489d760121f |
comparison
equal
deleted
inserted
replaced
19652:e21002d106ab | 20511:bced1f19cb1d |
---|---|
512 | 512 |
513 /************************************************************************** | 513 /************************************************************************** |
514 * Date/Time Functions | 514 * Date/Time Functions |
515 **************************************************************************/ | 515 **************************************************************************/ |
516 | 516 |
517 #ifdef _WIN32 | |
518 static long win32_get_tz_offset() { | |
519 TIME_ZONE_INFORMATION tzi; | |
520 DWORD ret; | |
521 long off = -1; | |
522 | |
523 if ((ret = GetTimeZoneInformation(&tzi)) != TIME_ZONE_ID_INVALID) | |
524 { | |
525 off = -(tzi.Bias * 60); | |
526 if (ret == TIME_ZONE_ID_DAYLIGHT) | |
527 off -= tzi.DaylightBias * 60; | |
528 } | |
529 | |
530 return off; | |
531 } | |
532 #endif | |
533 | |
534 const char *purple_get_tzoff_str(const struct tm *tm, gboolean iso) | 517 const char *purple_get_tzoff_str(const struct tm *tm, gboolean iso) |
535 { | 518 { |
536 static char buf[7]; | 519 static char buf[7]; |
537 long off; | 520 long off; |
538 gint8 min; | 521 gint8 min; |
543 | 526 |
544 if (new_tm.tm_isdst < 0) | 527 if (new_tm.tm_isdst < 0) |
545 g_return_val_if_reached(""); | 528 g_return_val_if_reached(""); |
546 | 529 |
547 #ifdef _WIN32 | 530 #ifdef _WIN32 |
548 if ((off = win32_get_tz_offset()) == -1) | 531 if ((off = wpurple_get_tz_offset()) == -1) |
549 return ""; | 532 return ""; |
550 #else | 533 #else |
551 # ifdef HAVE_TM_GMTOFF | 534 # ifdef HAVE_TM_GMTOFF |
552 off = new_tm.tm_gmtoff; | 535 off = new_tm.tm_gmtoff; |
553 # else | 536 # else |
851 if (tzoff == PURPLE_NO_TZ_OFF) | 834 if (tzoff == PURPLE_NO_TZ_OFF) |
852 tzoff = 0; | 835 tzoff = 0; |
853 #endif | 836 #endif |
854 | 837 |
855 #ifdef _WIN32 | 838 #ifdef _WIN32 |
856 if ((sys_tzoff = win32_get_tz_offset()) == -1) | 839 if ((sys_tzoff = wpurple_get_tz_offset()) == -1) |
857 tzoff = PURPLE_NO_TZ_OFF; | 840 tzoff = PURPLE_NO_TZ_OFF; |
858 else | 841 else |
859 tzoff += sys_tzoff; | 842 tzoff += sys_tzoff; |
860 #else | 843 #else |
861 #ifdef HAVE_TM_GMTOFF | 844 #ifdef HAVE_TM_GMTOFF |