util/time: remove unused SCGetSecondsUntil

Ticket: #9139
pull/16497/head
Lukas Sismis 1 month ago committed by Victor Julien
parent da64eace18
commit 6d58f1051f

@ -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;

@ -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);

Loading…
Cancel
Save