* mu-msg-str.[ch]: add mu_msg_str_display_date_s, displays time for time with
24h, date otherwise
This commit is contained in:
@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user