diff options
author | Douglas Christman <DouglasChristman@gmail.com> | 2016-11-24 20:34:17 +0100 |
---|---|---|
committer | Douglas Christman <DouglasChristman@gmail.com> | 2016-11-25 00:22:08 +0100 |
commit | 3215e35c405278491f55fb486d349f132e93f516 (patch) | |
tree | 92e59a861b2882caa1d720805bc0c07caa98bdb6 /src/basic/calendarspec.c | |
parent | calendarspec: reject strings with spurious spaces and signs (diff) | |
download | systemd-3215e35c405278491f55fb486d349f132e93f516.tar.xz systemd-3215e35c405278491f55fb486d349f132e93f516.zip |
calendarspec: make specifications with seconds wildcard reversible
"*:*:*" is now formatted as "*:*:*" instead of "*:*:00/1"
Diffstat (limited to 'src/basic/calendarspec.c')
-rw-r--r-- | src/basic/calendarspec.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/basic/calendarspec.c b/src/basic/calendarspec.c index 1555230e30..1de04feedf 100644 --- a/src/basic/calendarspec.c +++ b/src/basic/calendarspec.c @@ -286,6 +286,7 @@ static void format_chain(FILE *f, int space, const CalendarComponent *c, bool us } int calendar_spec_to_string(const CalendarSpec *c, char **p) { + CalendarComponent *cc; char *buf = NULL; size_t sz = 0; FILE *f; @@ -313,7 +314,12 @@ int calendar_spec_to_string(const CalendarSpec *c, char **p) { fputc(':', f); format_chain(f, 2, c->minute, false); fputc(':', f); - format_chain(f, 2, c->microsecond, true); + + cc = c->microsecond; + if (cc && !cc->value && cc->repeat == USEC_PER_SEC && !cc->next) + fputc('*', f); + else + format_chain(f, 2, c->microsecond, true); if (c->utc) fputs(" UTC", f); |