summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2019-03-03 13:19:48 +0100
committerHiltjo Posthuma <hiltjo@codemadness.org>2019-03-03 13:19:48 +0100
commit893de4b513adfa7464dbbc454151b9ec1559c0db (patch)
treeef44660ed448a75609ca30780a3b98811af4de77
parenta5600ecf20ec102553639567bc15d42857f97c18 (diff)
skip spaces in parsetime() itself
-rw-r--r--sfeed.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sfeed.c b/sfeed.c
index 16a94a9..8013551 100644
--- a/sfeed.c
+++ b/sfeed.c
@@ -343,7 +343,7 @@ string_print_timestamp(String *s)
if (!s->data || !s->len)
return;
- if (parsetime(ltrim(s->data), &t) != -1)
+ if (parsetime(s->data, &t) != -1)
printf("%lld", (long long)t);
}
@@ -495,6 +495,8 @@ parsetime(const char *s, time_t *tp)
int va[6] = { 0 }, i, j, v, vi;
size_t m;
+ for (; *s && isspace((unsigned char)*s); s++)
+ ;
if (!isdigit((unsigned char)*s) && !isalpha((unsigned char)*s))
return -1;