time stuff woof

This commit is contained in:
Joseph Redmon 2018-04-10 16:25:25 -07:00
parent 259be3217b
commit 508381b37f

View File

@ -7,6 +7,7 @@
#include <float.h> #include <float.h>
#include <limits.h> #include <limits.h>
#include <time.h> #include <time.h>
#include <sys/time.h>
#include "utils.h" #include "utils.h"
@ -25,9 +26,11 @@ double get_wall_time()
double what_time_is_it_now() double what_time_is_it_now()
{ {
struct timespec now; struct timeval time;
clock_gettime(CLOCK_REALTIME, &now); if (gettimeofday(&time,NULL)){
return now.tv_sec + now.tv_nsec*1e-9; return 0;
}
return (double)time.tv_sec + (double)time.tv_usec * .000001;
} }
int *read_intlist(char *gpu_list, int *ngpus, int d) int *read_intlist(char *gpu_list, int *ngpus, int d)