]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
bypass: switch to gettimeofday
authorVictor Julien <victor@inliniac.net>
Wed, 19 Jun 2019 17:39:52 +0000 (19:39 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 20 Jun 2019 09:23:06 +0000 (11:23 +0200)
src/flow-bypass.c

index fb00d40398d2d1accffcb5489ecd7fcbdb3fba85..c6b55ef833ed09ef9fbeacd2e0316a82e2dc8a48 100644 (file)
@@ -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)