svn commit: samba r8875 - in branches/SAMBA_4_0/source: gtk/common
lib lib/events torture/rpc
vlendec at samba.org
vlendec at samba.org
Mon Aug 1 00:34:39 GMT 2005
Author: vlendec
Date: 2005-08-01 00:34:39 +0000 (Mon, 01 Aug 2005)
New Revision: 8875
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8875
Log:
Rename timeval_diff to timeval_until and revert the arguments. timeval_diff is
not strictly a subtraction function, there can't be negative timevals.
Volker
Modified:
branches/SAMBA_4_0/source/gtk/common/gtk_events.c
branches/SAMBA_4_0/source/lib/events/events_standard.c
branches/SAMBA_4_0/source/lib/time.c
branches/SAMBA_4_0/source/torture/rpc/echo.c
Changeset:
Modified: branches/SAMBA_4_0/source/gtk/common/gtk_events.c
===================================================================
--- branches/SAMBA_4_0/source/gtk/common/gtk_events.c 2005-08-01 00:26:52 UTC (rev 8874)
+++ branches/SAMBA_4_0/source/gtk/common/gtk_events.c 2005-08-01 00:34:39 UTC (rev 8875)
@@ -281,7 +281,7 @@
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);
Modified: branches/SAMBA_4_0/source/lib/events/events_standard.c
===================================================================
--- branches/SAMBA_4_0/source/lib/events/events_standard.c 2005-08-01 00:26:52 UTC (rev 8874)
+++ branches/SAMBA_4_0/source/lib/events/events_standard.c 2005-08-01 00:34:39 UTC (rev 8875)
@@ -488,7 +488,7 @@
/* 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;
Modified: branches/SAMBA_4_0/source/lib/time.c
===================================================================
--- branches/SAMBA_4_0/source/lib/time.c 2005-08-01 00:26:52 UTC (rev 8874)
+++ branches/SAMBA_4_0/source/lib/time.c 2005-08-01 00:34:39 UTC (rev 8875)
@@ -561,21 +561,21 @@
/*
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;
}
Modified: branches/SAMBA_4_0/source/torture/rpc/echo.c
===================================================================
--- branches/SAMBA_4_0/source/torture/rpc/echo.c 2005-08-01 00:26:52 UTC (rev 8874)
+++ branches/SAMBA_4_0/source/torture/rpc/echo.c 2005-08-01 00:34:39 UTC (rev 8875)
@@ -254,7 +254,7 @@
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",
More information about the samba-cvs
mailing list