summaryrefslogtreecommitdiff
path: root/src/basic/time-util.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-09-20 19:26:13 +0200
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>2017-09-22 14:01:33 +0200
commit214cc95d7bfd6bd22a17c2ac1ab84e31d2e82640 (patch)
tree0e63f1deb3fb6feb9c50edcf2b19efa0efeb9e35 /src/basic/time-util.c
parent3fd4929b960776b5368222688cecabd6ec958f7b (diff)
downloadsystemd-214cc95d7bfd6bd22a17c2ac1ab84e31d2e82640.tar.gz
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.
Diffstat (limited to 'src/basic/time-util.c')
-rw-r--r--src/basic/time-util.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/basic/time-util.c b/src/basic/time-util.c
index bcfa42714d..f67467c5bd 100644
--- a/src/basic/time-util.c
+++ b/src/basic/time-util.c
@@ -849,11 +849,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;