From: Victor Julien Date: Wed, 19 Jun 2019 17:39:52 +0000 (+0200) Subject: bypass: switch to gettimeofday X-Git-Tag: suricata-5.0.0-rc1~276 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=287b87b81b34a425bb25fa69f294f4d61af82253;p=thirdparty%2Fsuricata.git bypass: switch to gettimeofday --- diff --git a/src/flow-bypass.c b/src/flow-bypass.c index fb00d40398..c6b55ef833 100644 --- a/src/flow-bypass.c +++ b/src/flow-bypass.c @@ -62,11 +62,10 @@ static TmEcode BypassedFlowManager(ThreadVars *th_v, void *thread_data) BypassedFlowManagerThreadData *ftd = thread_data; struct timespec curtime = {0, 0}; - if (clock_gettime(CLOCK_REALTIME, &curtime) != 0) { - SCLogError(SC_ERR_INVALID_VALUE, "Can't get time: %s (%d)", - strerror(errno), errno); - return TM_ECODE_FAILED; - } + struct timeval tv; + gettimeofday(&tv, NULL); + TIMEVAL_TO_TIMESPEC(&tv, &curtime); + for (i = 0; i < g_bypassed_func_max_index; i++) { if (bypassedfunclist[i].FuncInit) { bypassedfunclist[i].FuncInit(th_v, &curtime, bypassedfunclist[i].data); @@ -86,10 +85,9 @@ static TmEcode BypassedFlowManager(ThreadVars *th_v, void *thread_data) while (1) { SCLogDebug("Dumping the table"); - if (clock_gettime(CLOCK_REALTIME, &curtime) != 0) { - usleep(10000); - continue; - } + gettimeofday(&tv, NULL); + TIMEVAL_TO_TIMESPEC(&tv, &curtime); + for (i = 0; i < g_bypassed_func_max_index; i++) { struct flows_stats bypassstats = { 0, 0, 0}; if (bypassedfunclist[i].Func == NULL)