We have the same function in tevent, no need to duplicate code.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
switch (tp) {
case TEVENT_TRACE_BEFORE_WAIT:
- diff = timeval_until(&tevent_after_wait_ts, &now);
+ diff = tevent_timeval_until(&tevent_after_wait_ts, &now);
if (diff.tv_sec > 3) {
DEBUG(DEBUG_ERR,
("Handling event took %ld seconds!\n",
break;
case TEVENT_TRACE_AFTER_WAIT:
- diff = timeval_until(&tevent_before_wait_ts, &now);
+ diff = tevent_timeval_until(&tevent_before_wait_ts, &now);
if (diff.tv_sec > 3) {
DEBUG(DEBUG_ERR,
("No event for %ld seconds!\n",
return *tv2;
}
-/**
- return the difference between two timevals as a timeval
- if tv1 comes after tv2, then return a zero timeval
- (this is *tv2 - *tv1)
-*/
-_PUBLIC_ struct timeval timeval_until(const struct timeval *tv1,
- const struct timeval *tv2)
-{
- struct timeval t;
- if (timeval_compare(tv1, tv2) >= 0) {
- return timeval_zero();
- }
- t.tv_sec = tv2->tv_sec - tv1->tv_sec;
- if (tv1->tv_usec > tv2->tv_usec) {
- t.tv_sec--;
- t.tv_usec = 1000000 - (tv1->tv_usec - tv2->tv_usec);
- } else {
- t.tv_usec = tv2->tv_usec - tv1->tv_usec;
- }
- return t;
-}
-
-
/**
convert a timeval to a NTTIME
*/
struct timeval timeval_max(const struct timeval *tv1,
const struct timeval *tv2);
-/**
- return the difference between two timevals as a timeval
- if tv1 comes after tv2, then return a zero timeval
- (this is *tv2 - *tv1)
-*/
-struct timeval timeval_until(const struct timeval *tv1,
- const struct timeval *tv2);
-
/**
convert a timeval to a NTTIME
*/
total_done++;
done2[i] = true;
rcv[i] = timeval_current();
- diff[i] = timeval_until(&snd[i], &rcv[i]);
+ diff[i] = tevent_timeval_until(
+ &snd[i], &rcv[i]);
rounded_tdiff = (int)(0.5 + diff[i].tv_sec + (1.0e-6*diff[i].tv_usec));
torture_comment(tctx, "rounded_tdiff=%d\n", rounded_tdiff);
torture_assert_ntstatus_ok(tctx,