aboutsummaryrefslogtreecommitdiff
path: root/lib/time.c
diff options
context:
space:
mode:
authorChristian C <cc@localhost>2025-03-07 21:58:41 -0800
committerChristian C <cc@localhost>2025-03-07 21:58:41 -0800
commit0d1f5979dd1d6062af118fae3a1aa1863ea596f2 (patch)
tree4cb9973682409cbc23cd6c93cb26f14c4702d8ed /lib/time.c
parent12a1b2269c64bfbe61490a9a2a8eaa84ec3b41de (diff)
Library directories
Diffstat (limited to 'lib/time.c')
-rw-r--r--lib/time.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/time.c b/lib/time.c
new file mode 100644
index 0000000..085ef80
--- /dev/null
+++ b/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;
+}
+
+// Get Current Time
+void get_time(struct timespec *ts) {
+ timespec_get(ts, TIME_UTC);
+}