From e9bddf38e829184c3e569c4c666901e7b29f2e43 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Fri, 27 Oct 2017 06:36:47 +0200 Subject: Parse time before date in parse_datetime() Make sure that in cases when the date and time formats conflict, such as is the case with "0030", the input is interpreted as a time value, not a date. Suggested-by: Lars Henriksen Signed-off-by: Lukas Fleischer --- src/utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.c b/src/utils.c index 706484f..f3739ea 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1140,10 +1140,10 @@ int parse_datetime(const char *string, long *ts) ret |= PARSE_DATETIME_HAS_DATE | PARSE_DATETIME_HAS_TIME; } - } else if (parse_date_interactive(t, &year, &month, &day)) { - ret |= PARSE_DATETIME_HAS_DATE; } else if (parse_time(t, &hour, &minute)) { ret |= PARSE_DATETIME_HAS_TIME; + } else if (parse_date_interactive(t, &year, &month, &day)) { + ret |= PARSE_DATETIME_HAS_DATE; } if (ret & PARSE_DATETIME_HAS_DATE) { -- cgit v1.2.3-54-g00ecf