]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
time: minor code cleanup
authorVictor Julien <victor@inliniac.net>
Thu, 27 Feb 2020 19:20:33 +0000 (20:20 +0100)
committerJeff Lucovsky <jeff@lucovsky.org>
Sun, 5 Apr 2020 19:10:25 +0000 (15:10 -0400)
(cherry picked from commit 0325d185a85d69e10bf9e41af17d205097360b47)

src/util-time.c
src/util-time.h

index f1a1834ca0050667d842ae88ce1900cfc73451e5..d0ae2948801ea25e167927a37dac5e11d577a937 100644 (file)
@@ -69,7 +69,7 @@ static struct timeval current_time = { 0, 0 };
 #endif
 //static SCMutex current_time_mutex = SCMUTEX_INITIALIZER;
 static SCSpinlock current_time_spinlock;
-static char live = TRUE;
+static bool live_time_tracking = true;
 
 struct tm *SCLocalTime(time_t timep, struct tm *result);
 struct tm *SCUtcTime(time_t timep, struct tm *result);
@@ -89,24 +89,24 @@ void TimeDeinit(void)
 
 void TimeModeSetLive(void)
 {
-    live = TRUE;
+    live_time_tracking = true;
     SCLogDebug("live time mode enabled");
 }
 
 void TimeModeSetOffline (void)
 {
-    live = FALSE;
+    live_time_tracking = false;
     SCLogDebug("offline time mode enabled");
 }
 
-int TimeModeIsLive(void)
+bool TimeModeIsLive(void)
 {
-    return live;
+    return live_time_tracking;
 }
 
 void TimeSetByThread(const int thread_id, const struct timeval *tv)
 {
-    if (live == TRUE)
+    if (live_time_tracking)
         return;
 
     TmThreadsSetThreadTimestamp(thread_id, tv);
@@ -115,7 +115,7 @@ void TimeSetByThread(const int thread_id, const struct timeval *tv)
 #ifdef UNITTESTS
 void TimeSet(struct timeval *tv)
 {
-    if (live == TRUE)
+    if (live_time_tracking)
         return;
 
     if (tv == NULL)
@@ -148,7 +148,7 @@ void TimeGet(struct timeval *tv)
     if (tv == NULL)
         return;
 
-    if (live == TRUE) {
+    if (live_time_tracking) {
         gettimeofday(tv, NULL);
     } else {
 #ifdef UNITTESTS
index e3cfb8315b25f8115309d1cbd32b4f800884bc4c..6881b33cb3fbc8680f57ddb78d8297670f718d29 100644 (file)
@@ -51,7 +51,7 @@ void TimeSetIncrementTime(uint32_t);
 
 void TimeModeSetLive(void);
 void TimeModeSetOffline (void);
-int TimeModeIsLive(void);
+bool TimeModeIsLive(void);
 
 struct tm *SCLocalTime(time_t timep, struct tm *result);
 void CreateTimeString(const struct timeval *ts, char *str, size_t size);