From: Ivan Kurnosov Date: Sun, 17 Sep 2017 11:09:38 +0000 (+1200) Subject: Fix for dst/non-dst timezones X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=be101abd86d769b320fd6d40ff73e881474ca462;p=elogind.git Fix for dst/non-dst timezones 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. --- 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;