diff options
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/time-util.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/shared/time-util.c b/src/shared/time-util.c index 433c262dfa..4d34362bce 100644 --- a/src/shared/time-util.c +++ b/src/shared/time-util.c @@ -773,7 +773,7 @@ int parse_nsec(const char *t, nsec_t *nsec) { { "", 1ULL }, /* default is nsec */ }; - const char *p; + const char *p, *s; nsec_t r = 0; bool something = false; @@ -781,6 +781,18 @@ int parse_nsec(const char *t, nsec_t *nsec) { assert(nsec); p = t; + + p += strspn(p, WHITESPACE); + s = startswith(p, "infinity"); + if (s) { + s += strspn(s, WHITESPACE); + if (!*s != 0) + return -EINVAL; + + *nsec = NSEC_INFINITY; + return 0; + } + for (;;) { long long l, z = 0; char *e; |