1
1

Testing timeval equality deserves to be its own routine.

Этот коммит содержится в:
jef 2012-11-02 09:04:46 -07:00
родитель 99502d9409
Коммит 8a0cc10076
3 изменённых файлов: 12 добавлений и 2 удалений

Просмотреть файл

@ -1449,8 +1449,7 @@ print_interval_results(struct iperf_test * test, struct iperf_stream * sp)
** else if there's more than one stream, print the separator;
** else nothing.
*/
if (sp->result->start_time.tv_sec == ir->interval_start_time.tv_sec &&
sp->result->start_time.tv_usec == ir->interval_start_time.tv_usec)
if (timeval_equals(&sp->result->start_time, &ir->interval_start_time))
printf(report_bw_header);
else if (test->num_streams > 1)
printf(report_bw_separator);

Просмотреть файл

@ -30,6 +30,15 @@ timeval_to_double(struct timeval * tv)
return d;
}
int
timeval_equals(struct timeval * tv0, struct timeval * tv1)
{
if ( tv0->tv_sec == tv1->tv_sec && tv0->tv_usec == tv1->tv_usec )
return 1;
else
return 0;
}
double
timeval_diff(struct timeval * tv0, struct timeval * tv1)
{

Просмотреть файл

@ -25,6 +25,8 @@ int delay(int64_t ns);
double timeval_to_double(struct timeval *tv);
int timeval_equals(struct timeval *tv0, struct timeval *tv1);
double timeval_diff(struct timeval *tv0, struct timeval *tv1);
int update_timer(struct timer *tp, time_t sec, suseconds_t usec);