* use timegm instead of the tzset hack

This commit is contained in:
djcb
2013-10-07 00:50:36 +03:00
parent def8094b16
commit c898265ee5
3 changed files with 48 additions and 35 deletions

View File

@ -75,6 +75,26 @@ get_refs_str (GMimeMessage *msg)
return rv;
}
static void
print_date (GMimeMessage *msg)
{
time_t t;
int tz;
char buf[64];
size_t len;
struct tm *t_m;
g_mime_message_get_date (msg, &t, &tz);
t_m = localtime (&t);
len = strftime (buf, sizeof(buf) - 1, "%c", t_m);
if (len > 0)
g_print ("Date : %s (%s%04d)\n",
buf,tz < 0 ? "-" : "+", tz);
}
static gboolean
test_message (GMimeMessage *msg)
{
@ -98,6 +118,9 @@ test_message (GMimeMessage *msg)
str = g_mime_message_get_subject (msg);
g_print ("Subject: %s\n", str ? str : "<none>");
print_date (msg);
str = g_mime_message_get_message_id (msg);
g_print ("Msg-id : %s\n", str ? str : "<none>");