Mercurial > pidgin.yaz
changeset 25944:481e07d69a10
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?
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Mon, 09 Feb 2009 07:13:44 +0000 |
parents | b73c79f7490c |
children | 751df82b78e7 |
files | libpurple/protocols/jabber/buddy.c |
diffstat | 1 files changed, 8 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- 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))) {