Include stdio.h, time.h, & list.h before this header
*/
+#define US_PER_SEC 1000000
+
/** calculate the difference in useconds out of two "struct timespec"s */
#define DIFF_IN_USEC(begin, end) \
- ( (((end).tv_sec - (begin).tv_sec) * 1000000) + \
+ ( (((end).tv_sec - (begin).tv_sec) * US_PER_SEC) + \
((end).tv_nsec/1000) - ((begin).tv_nsec/1000) )
typedef struct TF {
clock_gettime(check_get_clockid(), &ts_end);
duration = DIFF_IN_USEC(ts_start, ts_end);
fprintf(file, " <duration>%u.%06u</duration>\n",
- duration / 1000000, duration % 1000000);
+ duration / US_PER_SEC, duration % US_PER_SEC);
fprintf(file, "</testsuites>\n");
}
break;