Skip to content

Commit

Permalink
time stuff woof
Browse files Browse the repository at this point in the history
  • Loading branch information
pjreddie committed Apr 10, 2018
1 parent 259be32 commit 508381b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <float.h>
#include <limits.h>
#include <time.h>
#include <sys/time.h>

#include "utils.h"

Expand All @@ -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)
Expand Down

0 comments on commit 508381b

Please sign in to comment.