From 508381b37fe75e0e1a01bcb2941cb0b31eb0e4c9 Mon Sep 17 00:00:00 2001 From: Joseph Redmon Date: Tue, 10 Apr 2018 16:25:25 -0700 Subject: [PATCH] time stuff woof --- src/utils.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/utils.c b/src/utils.c index 4e4efc2c..626b4678 100644 --- a/src/utils.c +++ b/src/utils.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "utils.h" @@ -25,9 +26,11 @@ double get_wall_time() double what_time_is_it_now() { - struct timespec now; - clock_gettime(CLOCK_REALTIME, &now); - return now.tv_sec + now.tv_nsec*1e-9; + struct timeval time; + if (gettimeofday(&time,NULL)){ + return 0; + } + return (double)time.tv_sec + (double)time.tv_usec * .000001; } int *read_intlist(char *gpu_list, int *ngpus, int d)