[misc] [PATCH] 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.

Signed-off-by: Lukas Fleischer <lfleischer@xxxxxxxxxxxx>
---
 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) {
-- 
2.14.3

Links