summaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorLoic Guegan <manzerbredes@mailbox.org>2023-07-15 10:11:50 +0200
committerLoic Guegan <manzerbredes@mailbox.org>2023-07-15 10:11:50 +0200
commit4fbfae704413fdba2558e539dd6c9b1b4a5aec91 (patch)
tree372bf4d734eef56cc865729aa3412fa8c45f6887 /src/utils.h
parent4169628e5793020655afb0b7e7233a19d83af429 (diff)
Minor changes
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utils.h b/src/utils.h
index 5da7feb..c215431 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -1,5 +1,15 @@
+#include <time.h>
+
#define STR(symbol) #symbol
#define STRINGIFY(symbol) STR(symbol)
#define INA260_SYSFS "/sys/kernel/ina260"
#define INA260_POWER_REGISTER "registers/power"
+
+#define INTERVAL(timestamp,duration)\
+ ((timestamp) - ((timestamp)%(duration)))
+
+#define INTERVAL_LAST(timestamp,duration)\
+ (INTERVAL(INTERVAL((timestamp),(duration))-1,(duration)))
+
+#define TIMESTAMP() (time(NULL))