aboutsummaryrefslogtreecommitdiff
path: root/src/lib/time.c
diff options
context:
space:
mode:
authorChristian C <cc@localhost>2025-03-04 19:10:07 -0800
committerChristian C <cc@localhost>2025-03-04 19:10:07 -0800
commitc61bb864c026d26a393f2a09c82de9bbc5043c6f (patch)
tree9f589bd8c0fa0823fe04da0753004386f0968844 /src/lib/time.c
parent49412195efd93573eb96ddbae6e41099964fdb65 (diff)
Modularization
Diffstat (limited to 'src/lib/time.c')
-rw-r--r--src/lib/time.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/time.c b/src/lib/time.c
new file mode 100644
index 0000000..2e5777b
--- /dev/null
+++ b/src/lib/time.c
@@ -0,0 +1,13 @@
+#include <lib/time.h>
+
+//-----------------------------------------------
+// Difference in Time
+// Compute the difference between timespec structs
+double diff_time(struct timespec *time1, struct timespec *time0) {
+ return (time1->tv_sec - time0->tv_sec)
+ + (time1->tv_nsec - time0->tv_nsec) / 1000000000.0;
+}
+
+void get_time(struct timespec *ts) {
+ timespec_get(ts, TIME_UTC);
+}