diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-10-25 22:58:00 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-10-25 22:58:00 +0100 |
commit | 46f190483facaccf6f8f2bfba453f7c7dd231b22 (patch) | |
tree | 127e8577554cbd3a173b7dd47b29b98b9ae99965 /src/basic/calendarspec.c | |
parent | f739078599ee9b1e00f643b5b4c45a0d57938fe1 (diff) | |
parent | b4ae407d3ed6701df4e079d65b8fc3607437c569 (diff) |
Merge pull request #1673 from mustrumr/date-fixes
Date fixes
Diffstat (limited to 'src/basic/calendarspec.c')
-rw-r--r-- | src/basic/calendarspec.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/basic/calendarspec.c b/src/basic/calendarspec.c index 987ca81910..50328e4187 100644 --- a/src/basic/calendarspec.c +++ b/src/basic/calendarspec.c @@ -650,6 +650,7 @@ fail: int calendar_spec_from_string(const char *p, CalendarSpec **spec) { CalendarSpec *c; int r; + const char *utc; assert(p); assert(spec); @@ -661,9 +662,11 @@ int calendar_spec_from_string(const char *p, CalendarSpec **spec) { if (!c) return -ENOMEM; - c->utc = endswith_no_case(p, "UTC"); - if (c->utc) - p = strndupa(p, strlen(p) - strlen(" UTC")); + utc = endswith_no_case(p, " UTC"); + if (utc) { + c->utc = true; + p = strndupa(p, utc - p); + } if (strcaseeq(p, "minutely")) { r = const_chain(0, &c->second); |