Skip to content

Commit

Permalink
threads/time: rename ts to pktts to make purpose clear
Browse files Browse the repository at this point in the history
  • Loading branch information
victorjulien committed Mar 3, 2020
1 parent ae41379 commit 4977dae
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/tm-threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -2101,7 +2101,8 @@ typedef struct Thread_ {
int type;
int in_use; /**< bool to indicate this is in use */

struct timeval ts; /**< current time of this thread (offline mode) */
struct timeval pktts; /**< current packet time of this thread
* (offline mode) */
} Thread;

typedef struct Threads_ {
Expand Down Expand Up @@ -2224,7 +2225,7 @@ void TmThreadsSetThreadTimestamp(const int id, const struct timeval *ts)

int idx = id - 1;
Thread *t = &thread_store.threads[idx];
COPY_TIMESTAMP(ts, &t->ts);
COPY_TIMESTAMP(ts, &t->pktts);
SCMutexUnlock(&thread_store_lock);
}

Expand All @@ -2235,7 +2236,7 @@ void TmThreadsInitThreadsTimestamp(const struct timeval *ts)
Thread *t = &thread_store.threads[s];
if (!t->in_use)
break;
COPY_TIMESTAMP(ts, &t->ts);
COPY_TIMESTAMP(ts, &t->pktts);
}
SCMutexUnlock(&thread_store_lock);
}
Expand All @@ -2253,14 +2254,14 @@ void TmThreadsGetMinimalTimestamp(struct timeval *ts)
Thread *t = &thread_store.threads[s];
if (t == NULL || t->in_use == 0)
continue;
if (!(timercmp(&t->ts, &nullts, ==))) {
if (!(timercmp(&t->pktts, &nullts, ==))) {
if (!set) {
local.tv_sec = t->ts.tv_sec;
local.tv_usec = t->ts.tv_usec;
local.tv_sec = t->pktts.tv_sec;
local.tv_usec = t->pktts.tv_usec;
set = 1;
} else {
if (timercmp(&t->ts, &local, <)) {
COPY_TIMESTAMP(&t->ts, &local);
if (timercmp(&t->pktts, &local, <)) {
COPY_TIMESTAMP(&t->pktts, &local);
}
}
}
Expand Down

0 comments on commit 4977dae

Please sign in to comment.