chiark / gitweb /
Fix for dst/non-dst timezones
authorIvan Kurnosov <zerkms@zerkms.com>
Sun, 17 Sep 2017 11:09:38 +0000 (23:09 +1200)
committerSven Eden <yamakuzure@gmx.net>
Sun, 17 Sep 2017 11:09:38 +0000 (23:09 +1200)
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 c1621df96e20d67e7b6566c0b3c10be771647bc7..9bcf5725ed47dd3b07790d0186a95f0fbb4d97cd 100644 (file)
@@ -747,11 +747,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;