ROSS
tw-timing.c
Go to the documentation of this file.
1 #include <ross.h>
2 
3 void
5 {
6  if(0 != gettimeofday((struct timeval *)t, NULL))
7  tw_error(TW_LOC, "Unable to get time of day!");
8 }
9 
10 void
12 {
13  r->tv_sec = a->tv_sec - b->tv_sec;
14  r->tv_usec = a->tv_usec - b->tv_usec;
15 
16  if (r->tv_usec < 0)
17  {
18  r->tv_sec--;
19  r->tv_usec += 1000000;
20  }
21 }
22 
23 double
25 {
26  return (double)t->tv_sec + (((double)t->tv_usec) / 1000000);
27 }
#define TW_LOC
Definition: ross-extern.h:164
void tw_error(const char *file, int line, const char *fmt,...) NORETURN
Definition: tw-util.c:74
void tw_wall_now(tw_wtime *t)
Definition: tw-timing.c:4
void tw_wall_sub(tw_wtime *r, tw_wtime *a, tw_wtime *b)
Definition: tw-timing.c:11
struct timeval tw_wtime
Definition: tw-timing.h:4
double tw_wall_to_double(tw_wtime *t)
Definition: tw-timing.c:24