Implement time sensor
[khatus.git] / x5 / khatus_lib_time.c
index ba74226..a169471 100644 (file)
@@ -7,6 +7,20 @@
 #include "khatus_lib_log.h"
 #include "khatus_lib_time.h"
 
+struct timespec
+timespec_of_float(double n)
+{
+       double integral;
+       double fractional;
+       struct timespec t;
+
+       fractional = modf(n, &integral);
+       t.tv_sec = (int) integral;
+       t.tv_nsec = (int) (1E9 * fractional);
+
+       return t;
+}
+
 void
 snooze(struct timespec *t)
 {
This page took 0.022481 seconds and 4 git commands to generate.