aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMosder <xmosder12@gmail.com>2026-06-13 20:08:47 +0200
committerMosder <xmosder12@gmail.com>2026-06-13 20:08:47 +0200
commit07bd987537275b23904f41f4795bf081d2421d0a (patch)
tree7ca4c2ef2f22c66caba945893cffcd7c5fb9e22a
parent9c23068056e2d07ea8e03b279c20db49a4c7ccbb (diff)
feat: created utils/time.h for helper functions regarding date and time
-rw-r--r--analyzer/utils/time.c10
-rw-r--r--analyzer/utils/time.h7
2 files changed, 17 insertions, 0 deletions
diff --git a/analyzer/utils/time.c b/analyzer/utils/time.c
new file mode 100644
index 0000000..72c0bc7
--- /dev/null
+++ b/analyzer/utils/time.c
@@ -0,0 +1,10 @@
+#include "time.h"
+
+#include <stdio.h>
+#include <time.h>
+
+void get_date_time_string(char *date_time) {
+ time_t now = time(NULL);
+ struct tm *t = localtime(&now);
+ sprintf(date_time, "%02d%02d%02d_%02d%02d%02d", t->tm_year - 100, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
+}
diff --git a/analyzer/utils/time.h b/analyzer/utils/time.h
new file mode 100644
index 0000000..0bd0df1
--- /dev/null
+++ b/analyzer/utils/time.h
@@ -0,0 +1,7 @@
+// utils/time.h
+// functions regarding date and time
+
+// gets a string <date>_<time> for current localtime
+// params:
+// date_time - buffer to save the datetime string to
+extern void get_date_time_string(char *date_time);