From be101abd86d769b320fd6d40ff73e881474ca462 Mon Sep 17 00:00:00 2001 From: Ivan Kurnosov Date: Sun, 17 Sep 2017 23:09:38 +1200 Subject: [PATCH] Fix for dst/non-dst timezones MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/basic/time-util.c b/src/basic/time-util.c index c1621df96..9bcf5725e 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c @@ -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; -- 2.30.2