summaryrefslogtreecommitdiff
path: root/src/basic/calendarspec.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/basic/calendarspec.c')
-rw-r--r--src/basic/calendarspec.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/basic/calendarspec.c b/src/basic/calendarspec.c
index a2296f4709..50328e4187 100644
--- a/src/basic/calendarspec.c
+++ b/src/basic/calendarspec.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
+#include "string-util.h"
#include "calendarspec.h"
#define BITS_WEEKDAYS 127
@@ -649,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);
@@ -660,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);