From 5147b19e5101a3f5053b377a062261e684047cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Sun, 15 Mar 2026 10:05:17 +0100 Subject: [PATCH] core: use function util_parse_longlong in function util_parse_time --- src/core/core-util.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/core/core-util.c b/src/core/core-util.c index 8e85c5c7f..dd09ef777 100644 --- a/src/core/core-util.c +++ b/src/core/core-util.c @@ -417,7 +417,7 @@ int util_parse_time (const char *datetime, struct timeval *tv) { char *string, *pos, *pos2, *pos_colon, *pos_hyphen, *pos_dot; - char str_usec[16], *error, str_date[128]; + char str_usec[16], str_date[128]; struct tm tm_date, tm_date_gm, tm_date_local, *local_time; time_t time_now, time_gm, time_local; long long value; @@ -488,9 +488,7 @@ util_parse_time (const char *datetime, struct timeval *tv) { strcat (str_usec, "0"); } - error = NULL; - value = strtoll (str_usec, &error, 10); - if (error && !error[0]) + if (util_parse_longlong (str_usec, 10, &value)) { /* * just in case: this should not happen as minus is not @@ -655,9 +653,7 @@ util_parse_time (const char *datetime, struct timeval *tv) else { /* timestamp format: "1704402062" */ - error = NULL; - value = strtoll (string, &error, 10); - if (error && !error[0] && (value >= 0)) + if (util_parse_longlong (string, 10, &value) && (value >= 0)) { tv->tv_sec = (time_t)value; rc = 1;