From: Victor Julien Date: Wed, 10 Nov 2021 14:40:26 +0000 (+0100) Subject: time: add timeradd implementation X-Git-Tag: suricata-5.0.8~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=57abc1dbf5a36c06196660e9f7e98510a4aa1789;p=thirdparty%2Fsuricata.git time: add timeradd implementation timeradd isn't available on MinGW. --- diff --git a/src/util-time.h b/src/util-time.h index 501a2ebc3f..9e189176db 100644 --- a/src/util-time.h +++ b/src/util-time.h @@ -44,6 +44,18 @@ void TimeGet(struct timeval *); (((tv_first).tv_sec < (tv_second).tv_sec) || \ ((tv_first).tv_sec == (tv_second).tv_sec && (tv_first).tv_usec < (tv_second).tv_usec)) +#ifndef timeradd +#define timeradd(a, b, r) \ + do { \ + (r)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ + (r)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ + if ((r)->tv_usec >= 1000000) { \ + (r)->tv_sec++; \ + (r)->tv_usec -= 1000000; \ + } \ + } while (0) +#endif + #ifdef UNITTESTS void TimeSet(struct timeval *); void TimeSetToCurrentTime(void);