32 struct timeval start_time;
33 struct timeval stop_time;
34 struct timeval since_time;
35 struct timeval diff_time;
40 #define _timersub Timersub
43 int Timersub(
struct timeval* ,
struct timeval* ,
struct timeval* );
73 gettimeofday (
t,
nullptr);
90 if (
t==NULL)
t = init_gtttimer();
92 t->since_time =
t->start_time;
95 if (
t==NULL)
return -1;
97 t->since_time =
t->stop_time;
98 _timersub( &(
t->stop_time), &(
t->start_time), &(
t->diff_time) );
99 time = (
t->diff_time.tv_sec*1000.0) + (
t->diff_time.tv_usec/1000.0);
102 if (
t==NULL)
return -1;
104 _timersub( &(
t->stop_time), &(
t->since_time), &(
t->diff_time) );
105 t->since_time =
t->stop_time;
106 time = (
t->diff_time.tv_sec*1000.0) + (
t->diff_time.tv_usec/1000.0);
120 struct timeval start_time;
131 struct timeval stop_time;
132 struct timeval diff_time;
137 _timersub( &stop_time, &start_time, &diff_time );
142 time = (diff_time.tv_sec*1000.0) + (diff_time.tv_usec/1000.0);
147 int Timersub(
struct timeval* stop_time,
struct timeval* start_time,
struct timeval* diff_time)
149 diff_time->tv_sec = stop_time->tv_sec - start_time->tv_sec;
150 diff_time->tv_usec = stop_time->tv_usec - start_time->tv_usec;