From f7dcd51ce43c892abc24c6f22cddddc47feb81a0 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Wed, 20 Sep 2017 19:26:13 +0200 Subject: [PATCH] time-util: mktime_or_timegm are changing the struct tm after that wm_day etc. seems to be changed. Moving the check infront of the mktime_or_timegm fixes that. --- src/basic/time-util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/basic/time-util.c b/src/basic/time-util.c index 3f3ec6890..f984f46b5 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c @@ -861,11 +861,11 @@ parse_usec: } from_tm: - x = mktime_or_timegm(&tm, utc); - if (x < 0) + if (weekday >= 0 && tm.tm_wday != weekday) return -EINVAL; - if (weekday >= 0 && tm.tm_wday != weekday) + x = mktime_or_timegm(&tm, utc); + if (x < 0) return -EINVAL; ret = (usec_t) x * USEC_PER_SEC + x_usec; -- 2.30.2