]> git.ozlabs.org Git - ccan/blobdiff - tools/tools.c
tal/str: move tal string functions here from tal.
[ccan] / tools / tools.c
index 1eddf7e934ab9f658cadb9fe4e7a2c34b8312b15..77349d93c33b463e4dc5e18617d90d5229f497b4 100644 (file)
@@ -1,5 +1,6 @@
 #include <ccan/talloc/talloc.h>
 #include <ccan/grab_file/grab_file.h>
+#include <ccan/err/err.h>
 #include <ccan/noerr/noerr.h>
 #include <ccan/read_write_all/read_write_all.h>
 #include <ccan/noerr/noerr.h>
@@ -13,7 +14,6 @@
 #include <unistd.h>
 #include <stdarg.h>
 #include <errno.h>
-#include <err.h>
 #include <unistd.h>
 #include <assert.h>
 #include <signal.h>
@@ -73,7 +73,7 @@ char *run_with_timeout(const void *ctx, const char *cmd,
        int p[2];
        char *ret;
        int status, ms;
-       struct timeval start;
+       struct timespec start;
 
        *ok = false;
        if (pipe(p) != 0)
@@ -106,7 +106,7 @@ char *run_with_timeout(const void *ctx, const char *cmd,
 
                signal(SIGALRM, killme);
                itim.it_interval.tv_sec = itim.it_interval.tv_usec = 0;
-               itim.it_value = time_from_msec(*timeout_ms);
+               itim.it_value = timespec_to_timeval(time_from_msec(*timeout_ms));
                setitimer(ITIMER_REAL, &itim, NULL);
 
                status = system(cmd);