diff options
-rw-r--r-- | source4/gtk/common/gtk_events.c | 2 | ||||
-rw-r--r-- | source4/lib/events/events_standard.c | 2 | ||||
-rw-r--r-- | source4/lib/time.c | 16 | ||||
-rw-r--r-- | source4/torture/rpc/echo.c | 2 |
4 files changed, 11 insertions, 11 deletions
diff --git a/source4/gtk/common/gtk_events.c b/source4/gtk/common/gtk_events.c index faa99a780e..fdc6d55621 100644 --- a/source4/gtk/common/gtk_events.c +++ b/source4/gtk/common/gtk_events.c @@ -281,7 +281,7 @@ static struct timed_event *gtk_event_add_timed(struct event_context *ev, TALLOC_ te->additional_data = gtk_te; cur_tv = timeval_current(); - diff_tv = timeval_diff(&next_event, &cur_tv); + diff_tv = timeval_until(&cur_tv, &next_event); timeout = ((diff_tv.tv_usec+999)/1000)+(diff_tv.tv_sec*1000); gtk_te->te_id = g_timeout_add(timeout, gtk_event_timed_handler, te); diff --git a/source4/lib/events/events_standard.c b/source4/lib/events/events_standard.c index 5a64a42b28..16c9464fd0 100644 --- a/source4/lib/events/events_standard.c +++ b/source4/lib/events/events_standard.c @@ -488,7 +488,7 @@ static int std_event_loop_once(struct event_context *ev) /* work out the right timeout for all timed events */ if (std_ev->timed_events) { struct timeval t = timeval_current(); - tval = timeval_diff(&std_ev->timed_events->next_event, &t); + tval = timeval_until(&t, &std_ev->timed_events->next_event); if (timeval_is_zero(&tval)) { std_event_loop_timer(ev); return 0; diff --git a/source4/lib/time.c b/source4/lib/time.c index 7b371f58dd..1fce5af06d 100644 --- a/source4/lib/time.c +++ b/source4/lib/time.c @@ -561,21 +561,21 @@ struct timeval timeval_max(struct timeval *tv1, struct timeval *tv2) /* return the difference between two timevals as a timeval - if tv2 comes after tv1, then return a zero timeval - (this is *tv1 - *tv2) + if tv1 comes after tv2, then return a zero timeval + (this is *tv2 - *tv1) */ -struct timeval timeval_diff(struct timeval *tv1, struct timeval *tv2) +struct timeval timeval_until(struct timeval *tv1, struct timeval *tv2) { struct timeval t; - if (timeval_compare(tv1, tv2) >= 0) { + if (timeval_compare(tv2, tv1) >= 0) { return timeval_zero(); } - t.tv_sec = tv1->tv_sec - tv2->tv_sec; - if (tv2->tv_usec > tv1->tv_usec) { + t.tv_sec = tv2->tv_sec - tv1->tv_sec; + if (tv1->tv_usec > tv2->tv_usec) { t.tv_sec--; - t.tv_usec = 1000000 - (tv2->tv_usec - tv1->tv_usec); + t.tv_usec = 1000000 - (tv1->tv_usec - tv2->tv_usec); } else { - t.tv_usec = tv1->tv_usec - tv2->tv_usec; + t.tv_usec = tv2->tv_usec - tv1->tv_usec; } return t; } diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c index a579190f47..4e0cf90e42 100644 --- a/source4/torture/rpc/echo.c +++ b/source4/torture/rpc/echo.c @@ -254,7 +254,7 @@ static BOOL test_sleep(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx) total_done++; done[i] = True; rcv[i] = timeval_current(); - diff[i] = timeval_diff(&rcv[i], &snd[i]); + diff[i] = timeval_until(&snd[i], &rcv[i]); status = dcerpc_ndr_request_recv(req[i]); if (!NT_STATUS_IS_OK(status)) { printf("TestSleep(%d) failed - %s\n", |