Mercurial > pidgin
changeset 32429:9e72389456f6
Ensure timestamps in header all all the same.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Mon, 02 Jan 2012 09:13:39 +0000 |
parents | b65989301854 |
children | 79fdae8fa875 d5363fbfa031 |
files | pidgin/gtkconv.c |
diffstat | 1 files changed, 16 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/gtkconv.c Mon Jan 02 07:58:32 2012 +0000 +++ b/pidgin/gtkconv.c Mon Jan 02 09:13:39 2012 +0000 @@ -5045,6 +5045,8 @@ GString *str; const char *cur = text; const char *prev = cur; + time_t mtime; + struct tm *tm = NULL; if (text == NULL || *text == '\0') return NULL; @@ -5081,6 +5083,7 @@ } else if (g_str_has_prefix(cur, "%timeOpened")) { const char *tmp = cur + strlen("%timeOpened"); char *format = NULL; + if (*tmp == '{') { const char *end; tmp++; @@ -5090,11 +5093,22 @@ format = g_strndup(tmp, end - tmp); fin = end + 1; } - replace = purple_utf8_strftime(format ? format : "%X", NULL); + + if (!tm) { + mtime = time(NULL); + tm = localtime(&mtime); + } + + replace = purple_utf8_strftime(format ? format : "%X", tm); g_free(format); } else if (g_str_has_prefix(cur, "%dateOpened%")) { - replace = purple_date_format_short(NULL); + if (!tm) { + mtime = time(NULL); + tm = localtime(&mtime); + } + + replace = purple_date_format_short(tm); } else { cur++;