bypass: switch to gettimeofday

pull/3961/head
Victor Julien 6 years ago
parent d8614a15c6
commit 287b87b81b

@ -62,11 +62,10 @@ static TmEcode BypassedFlowManager(ThreadVars *th_v, void *thread_data)
BypassedFlowManagerThreadData *ftd = thread_data; BypassedFlowManagerThreadData *ftd = thread_data;
struct timespec curtime = {0, 0}; struct timespec curtime = {0, 0};
if (clock_gettime(CLOCK_REALTIME, &curtime) != 0) { struct timeval tv;
SCLogError(SC_ERR_INVALID_VALUE, "Can't get time: %s (%d)", gettimeofday(&tv, NULL);
strerror(errno), errno); TIMEVAL_TO_TIMESPEC(&tv, &curtime);
return TM_ECODE_FAILED;
}
for (i = 0; i < g_bypassed_func_max_index; i++) { for (i = 0; i < g_bypassed_func_max_index; i++) {
if (bypassedfunclist[i].FuncInit) { if (bypassedfunclist[i].FuncInit) {
bypassedfunclist[i].FuncInit(th_v, &curtime, bypassedfunclist[i].data); bypassedfunclist[i].FuncInit(th_v, &curtime, bypassedfunclist[i].data);
@ -86,10 +85,9 @@ static TmEcode BypassedFlowManager(ThreadVars *th_v, void *thread_data)
while (1) { while (1) {
SCLogDebug("Dumping the table"); SCLogDebug("Dumping the table");
if (clock_gettime(CLOCK_REALTIME, &curtime) != 0) { gettimeofday(&tv, NULL);
usleep(10000); TIMEVAL_TO_TIMESPEC(&tv, &curtime);
continue;
}
for (i = 0; i < g_bypassed_func_max_index; i++) { for (i = 0; i < g_bypassed_func_max_index; i++) {
struct flows_stats bypassstats = { 0, 0, 0}; struct flows_stats bypassstats = { 0, 0, 0};
if (bypassedfunclist[i].Func == NULL) if (bypassedfunclist[i].Func == NULL)

Loading…
Cancel
Save