summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThomas Weißschuh <thomas@t-8ch.de>2023-01-20 02:43:34 +0000
committerThomas Weißschuh <thomas@t-8ch.de>2023-01-23 13:47:01 +0000
commit2abb8394fa89303b21003bd8252e52751c07f08c (patch)
treee351cd6e4f686c34b82b68d21813057b5897aedd /lib
parentd9cc65cb7e538beb9ab1cfdabae7127209e3b46d (diff)
downloadutil-linux-2abb8394fa89303b21003bd8252e52751c07f08c.tar.gz
lib/timeutils: parse_timestamp: fix second parsing
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/timeutils.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/timeutils.c b/lib/timeutils.c
index 6a7d1c26c..79b674907 100644
--- a/lib/timeutils.c
+++ b/lib/timeutils.c
@@ -324,10 +324,8 @@ static int parse_timestamp_reference(time_t x, const char *t, usec_t *usec)
tm = copy;
k = strptime(t, "%Y%m%d%H%M%S", &tm);
- if (k && *k == 0) {
- tm.tm_sec = 0;
+ if (k && *k == 0)
goto finish;
- }
return -EINVAL;
@@ -600,6 +598,7 @@ static int run_unittest_timestamp(void)
{ "tomorrow" , 1674259200000000 },
{ "+5min" , 1674180727000000 },
{ "-5days" , 1673748427000000 },
+ { "20120922163422" , 1348331662000000 },
};
if (unsetenv("TZ"))