aboutsummaryrefslogtreecommitdiff
path: root/src/lib/time.c
diff options
context:
space:
mode:
authorChristian Cunningham <cc@local.lan>2025-03-04 19:10:07 -0800
committerChristian Cunningham <cc@local.lan>2025-03-04 19:10:07 -0800
commit8e719bf59a78559b5128cefa0479c71245cbdcb2 (patch)
tree9f589bd8c0fa0823fe04da0753004386f0968844 /src/lib/time.c
parent3e1246d3da2bfdee08f92b35677f991622e43768 (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);
+}