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.
This commit is contained in:
Ivan Kurnosov 2017-09-17 23:09:38 +12:00 committed by Zbigniew Jędrzejewski-Szmek
parent a3da4a3d0a
commit 2e72b79459

View 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;