Move config defaults from global into main
[khatus.git] / x5 / khatus_lib_time.c
index ba74226..d13f689 100644 (file)
@@ -1,12 +1,27 @@
 #include <errno.h>
 #include <math.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <time.h>
 
 #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.028876 seconds and 4 git commands to generate.