summaryrefslogtreecommitdiff
path: root/security/wazuh-manager/files/patch-src-shared_modules-utils_timeHelper.h
blob: 6cd990bde29e8b742b67b557c9bad80d60baff25 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
--- src/shared_modules/utils/timeHelper.h.orig	2024-10-17 00:22:27.000000000 -0700
+++ src/shared_modules/utils/timeHelper.h	2024-10-20 00:02:09.915969000 -0700
@@ -196,6 +196,17 @@
         return output.str();
     }
 
+    static std::string timeToSeconds(std::string& str) {
+        int seconds;
+        std::tm t;
+        std::istringstream ss(str);
+        ss >> std::get_time(&t, "%H:%M.%S");
+
+        seconds = t.tm_hour * 3600 + t.tm_min * 60 + t.tm_sec;
+
+        return std::to_string(seconds);
+    }
+
     /**
      * @brief Get seconds from epoch, since 1970-01-01 00:00:00 UTC.
      * @return seconds from epoch.