* mu-msg-str.[ch]: add mu_msg_str_display_date_s, displays time for time with

24h, date otherwise
This commit is contained in:
Dirk-Jan C. Binnema
2010-11-07 18:24:48 +02:00
parent ab0ad61648
commit 93cf7856d1
2 changed files with 35 additions and 3 deletions

View File

@ -65,12 +65,31 @@ mu_msg_str_date_s (const char* frm, time_t t)
}
char*
mu_msg_str_date (const char* frm, time_t t)
mu_msg_str_date (const char *frm, time_t t)
{
return g_strdup (mu_msg_str_date_s(frm, t));
}
const char*
mu_msg_str_display_date_s (time_t t)
{
time_t now;
static const guint SECS_IN_DAY = 24 * 60 * 60;
now = time (NULL);
if (ABS(now - t) > SECS_IN_DAY)
return mu_msg_str_date_s ("%x", t);
else
return mu_msg_str_date_s ("%X", t);
}
const char*
mu_msg_str_size_s (size_t s)
{