]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Fix for dst/non-dst timezones 6788/head
authorIvan Kurnosov <zerkms@zerkms.com>
Sun, 17 Sep 2017 11:09:38 +0000 (23:09 +1200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 17 Sep 2017 11:49:14 +0000 (13:49 +0200)
The problem was with the tm.tm_isdst that is set to the current environment
value: either DST or not. While the current state is not relevant to the state
in the desired date.

Hence — it should be reset so that the mktime_or_timegm could normalise it
later.

src/basic/time-util.c

index 2577088c2f63e7c0700297072a68555c8b78f081..00979bfe594a7b2b05973002683790afa93fb528 100644 (file)
@@ -735,11 +735,9 @@ static int parse_timestamp_impl(const char *t, usec_t *usec, bool with_tz) {
         if (!localtime_or_gmtime_r(&x, &tm, utc))
                 return -EINVAL;
 
-        if (!with_tz) {
-                tm.tm_isdst = dst;
-                if (tzn)
-                        tm.tm_zone = tzn;
-        }
+        tm.tm_isdst = dst;
+        if (!with_tz && tzn)
+                tm.tm_zone = tzn;
 
         if (streq(t, "today")) {
                 tm.tm_sec = tm.tm_min = tm.tm_hour = 0;