# HG changeset patch # User Paul Aurich # Date 1234163624 0 # Node ID 481e07d69a10618a18711f45b2b7932957b629dc # Parent b73c79f7490cce3fea192e40b5c967eaeefa8d91 Format the time as "localtimeformat [+-]HHMM". Iterative development is fun. This shows up, for me, as "Local Time: 10:50:15 PM -0800". Marcus, I figure this bypasses the need to localize 'GMT'. Are there any locales where either the tz offset is always printed (my reading is that this would show up in the conversation window, so I doubt it) or where a tz offset is printed before the time? diff -r b73c79f7490c -r 481e07d69a10 libpurple/protocols/jabber/buddy.c --- a/libpurple/protocols/jabber/buddy.c Mon Feb 09 00:03:08 2009 +0000 +++ b/libpurple/protocols/jabber/buddy.c Mon Feb 09 07:13:44 2009 +0000 @@ -806,21 +806,16 @@ time_t now_t; struct tm *now; char *timestamp; - char *timezone; time(&now_t); now_t += jbr->tz_off; now = gmtime(&now_t); - if (jbr->tz_off) - timezone = g_strdup_printf("%02d:%02d", (int)(jbr->tz_off / (60*60)), - abs((jbr->tz_off % (60*60)) / 60)); - else - timezone = NULL; - timestamp = g_strdup_printf("%s GMT%s", purple_time_format(now), - timezone ? timezone : ""); + timestamp = g_strdup_printf("%s %c%02d%02d", purple_time_format(now), + jbr->tz_off < 0 ? '-' : '+', + abs(jbr->tz_off / (60*60)), + abs((jbr->tz_off % (60*60)) / 60)); purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); g_free(timestamp); - g_free(timezone); } if(jbir) { if(jbir->idle_seconds > 0) { @@ -996,21 +991,16 @@ time_t now_t; struct tm *now; char *timestamp; - char *timezone; time(&now_t); now_t += jbr->tz_off; now = gmtime(&now_t); - if (jbr->tz_off) - timezone = g_strdup_printf("%02d:%02d", (int)(jbr->tz_off / (60*60)), - abs((jbr->tz_off % (60*60)) / 60)); - else - timezone = NULL; - timestamp = g_strdup_printf("%s GMT%s", purple_time_format(now), - timezone ? timezone : ""); + timestamp = g_strdup_printf("%s %c%02d%02d", purple_time_format(now), + jbr->tz_off < 0 ? '-' : '+', + abs(jbr->tz_off / (60*60)), + abs((jbr->tz_off % (60*60)) / 60)); purple_notify_user_info_prepend_pair(user_info, _("Local Time"), timestamp); g_free(timestamp); - g_free(timezone); } if(jbr->name && (jbir = g_hash_table_lookup(jbi->resources, jbr->name))) {