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