Fix timezone handling in procheader_date_parse() on Windows.
authorAndrej Kacian <ticho@claws-mail.org>
Fri, 24 Mar 2017 10:11:58 +0000 (11:11 +0100)
committerAndrej Kacian <ticho@claws-mail.org>
Fri, 24 Mar 2017 10:13:15 +0000 (11:13 +0100)
This fixes logic error introduced in 029174b.

src/procheader.c

index ea20c93bf2e19ad3323f1358b2dd0236b974989c..327774009370f6d0200eb76cde399b4049eb7fc5 100644 (file)
@@ -1059,21 +1059,14 @@ time_t procheader_date_parse(gchar *dest, const gchar *src, gint len)
        GTimeZone *tz;
        GDateTime *dt, *dt2;
 
-       /* First create a valid GDateTime in UTC. */
-       tz = g_time_zone_new_utc();
+       tz = g_time_zone_new(zone); // can't return NULL no need to check for it
        dt = g_date_time_new(tz, 1, 1, 1, 0, 0, 0);
        g_time_zone_unref(tz);
        dt2 = g_date_time_add_full(dt, year-1, dmonth-1, day-1, hh, mm, ss);
        g_date_time_unref(dt);
 
-       /* Now we shift it to the desired time zone. */
-       tz = g_time_zone_new(zone);
-       dt = g_date_time_to_timezone(dt2, tz);
+       timer = g_date_time_to_unix(dt2);
        g_date_time_unref(dt2);
-       g_time_zone_unref(tz);
-
-       timer = g_date_time_to_unix(dt);
-       g_date_time_unref(dt);
 
 #else
        struct tm t;