From 6d58f1051f4e4347a58d9f5c0cba8c5a29f711a5 Mon Sep 17 00:00:00 2001 From: Lukas Sismis Date: Fri, 25 Sep 2026 21:11:23 +0200 Subject: [PATCH] util/time: remove unused SCGetSecondsUntil Ticket: #9139 --- src/util-time.c | 26 -------------------------- src/util-time.h | 3 +-- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/util-time.c b/src/util-time.c index 9bf8890577..6ef88accb2 100644 --- a/src/util-time.c +++ b/src/util-time.c @@ -628,32 +628,6 @@ uint64_t SCParseTimeSizeString (const char *str) return (size * modifier); } -/** - * \brief Get seconds until a time unit changes. - * - * \param str String containing time type (minute, hour, etc). - * \param epoch Epoch time. - * - * \retval seconds. - */ -uint64_t SCGetSecondsUntil (const char *str, time_t epoch) -{ - uint64_t seconds = 0; - struct tm tm; - memset(&tm, 0, sizeof(tm)); - struct tm *tp = (struct tm *)SCLocalTime(epoch, &tm); - - if (strcmp(str, "minute") == 0) - seconds = 60 - tp->tm_sec; - else if (strcmp(str, "hour") == 0) - seconds = (60 * (60 - tp->tm_min)) + (60 - tp->tm_sec); - else if (strcmp(str, "day") == 0) - seconds = (3600 * (24 - tp->tm_hour)) + (60 * (60 - tp->tm_min)) + - (60 - tp->tm_sec); - - return seconds; -} - uint64_t SCTimespecAsEpochMillis(const struct timespec* ts) { return ts->tv_sec * 1000L + ts->tv_nsec / 1000000L; diff --git a/src/util-time.h b/src/util-time.h index 2e577ca4b5..53c1e1feb8 100644 --- a/src/util-time.h +++ b/src/util-time.h @@ -157,8 +157,7 @@ int SCStringPatternToTime(char *string, const char **patterns, int num_patterns, struct tm *time); int SCTimeToStringPattern (time_t epoch, const char *pattern, char *str, size_t size); -uint64_t SCParseTimeSizeString (const char *str); -uint64_t SCGetSecondsUntil (const char *str, time_t epoch); +uint64_t SCParseTimeSizeString(const char *str); uint64_t SCTimespecAsEpochMillis(const struct timespec *ts); uint64_t TimeDifferenceMicros(struct timeval t0, struct timeval t1);