]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
af-packet: use time() instead of GetTime()
authorEric Leblond <eric@regit.org>
Tue, 26 Apr 2016 17:55:51 +0000 (19:55 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 20 May 2016 10:32:40 +0000 (12:32 +0200)
As we only use the second we don't need GetTime() which is slower
and get us milliseconds.

src/source-af-packet.c

index 0581f00e72e42de9cdb87b94adb2b7a396132416..8a429b78f1b58f293294a7bca1f795056f1c78b1 100644 (file)
@@ -1300,7 +1300,7 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
     int r;
     TmSlot *s = (TmSlot *)slot;
     time_t last_dump = 0;
-    struct timeval current_time;
+    time_t current_time;
     int (*AFPReadFunc) (AFPThreadVars *);
     uint64_t discarded_pkts = 0;
 
@@ -1419,10 +1419,10 @@ TmEcode ReceiveAFPLoop(ThreadVars *tv, void *data, void *slot)
             switch (r) {
                 case AFP_READ_OK:
                     /* Trigger one dump of stats every second */
-                    TimeGet(&current_time);
-                    if (current_time.tv_sec != last_dump) {
+                    current_time = time(NULL);
+                    if (current_time != last_dump) {
                         AFPDumpCounters(ptv);
-                        last_dump = current_time.tv_sec;
+                        last_dump = current_time;
                     }
                     break;
                 case AFP_READ_FAILURE: