time stuff woof

This commit is contained in:
Joseph Redmon 2018-04-10 16:25:25 -07:00
parent 259be3217b
commit 508381b37f
1 changed files with 6 additions and 3 deletions

View File

@ -7,6 +7,7 @@
#include <float.h>
#include <limits.h>
#include <time.h>
#include <sys/time.h>
#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)