From: Victor Julien Date: Tue, 18 Oct 2022 12:08:02 +0000 (+0200) Subject: detect/tag: improve time handling on windows X-Git-Tag: suricata-7.0.0-beta1~63 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0977f40d1cf6d5dad75c95f31614678225a77943;p=thirdparty%2Fsuricata.git detect/tag: improve time handling on windows Bug: #5584. --- diff --git a/src/detect-engine-tag.c b/src/detect-engine-tag.c index d445560f39..61cada6547 100644 --- a/src/detect-engine-tag.c +++ b/src/detect-engine-tag.c @@ -555,7 +555,9 @@ int TagTimeoutCheck(Host *host, struct timeval *tv) prev = NULL; while (tmp != NULL) { - if ((tv->tv_sec - tmp->last_ts) <= TAG_MAX_LAST_TIME_SEEN) { + struct timeval last_ts = { .tv_sec = tmp->last_ts, 0 }; + struct timeval timeout_at = TimevalWithSeconds(&last_ts, TAG_MAX_LAST_TIME_SEEN); + if (!TimevalEarlier(&timeout_at, tv)) { prev = tmp; tmp = tmp->next; retval = 0;