Author: vlendec Date: 2005-08-01 17:31:40 +0000 (Mon, 01 Aug 2005) New Revision: 8886
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=8886 Log: Exchange the arguments of timeval_compare, this makes it behave like strcmp. Volker Modified: branches/SAMBA_4_0/source/lib/events/events_standard.c branches/SAMBA_4_0/source/lib/time.c Changeset: Modified: branches/SAMBA_4_0/source/lib/events/events_standard.c =================================================================== --- branches/SAMBA_4_0/source/lib/events/events_standard.c 2005-08-01 16:32:48 UTC (rev 8885) +++ branches/SAMBA_4_0/source/lib/events/events_standard.c 2005-08-01 17:31:40 UTC (rev 8886) @@ -311,7 +311,8 @@ for (cur_te = std_ev->timed_events; cur_te; cur_te = cur_te->next) { /* if the new event comes before the current one break */ if (!timeval_is_zero(&cur_te->next_event) && - timeval_compare(&cur_te->next_event, &te->next_event) < 0) { + timeval_compare(&te->next_event, + &cur_te->next_event) < 0) { break; } Modified: branches/SAMBA_4_0/source/lib/time.c =================================================================== --- branches/SAMBA_4_0/source/lib/time.c 2005-08-01 16:32:48 UTC (rev 8885) +++ branches/SAMBA_4_0/source/lib/time.c 2005-08-01 17:31:40 UTC (rev 8886) @@ -497,16 +497,16 @@ /* compare two timeval structures. - Return 1 if tv2 > tv1 - Return 0 if tv2 == tv1 - Return -1 if tv2 < tv1 + Return -1 if tv1 < tv2 + Return 0 if tv1 == tv2 + Return 1 if tv1 > tv2 */ int timeval_compare(const struct timeval *tv1, const struct timeval *tv2) { - if (tv2->tv_sec > tv1->tv_sec) return 1; - if (tv2->tv_sec < tv1->tv_sec) return -1; - if (tv2->tv_usec > tv1->tv_usec) return 1; - if (tv2->tv_usec < tv1->tv_usec) return -1; + if (tv1->tv_sec > tv2->tv_sec) return 1; + if (tv1->tv_sec < tv2->tv_sec) return -1; + if (tv1->tv_usec > tv2->tv_usec) return 1; + if (tv1->tv_usec < tv2->tv_usec) return -1; return 0; } @@ -572,7 +572,7 @@ const struct timeval *tv2) { struct timeval t; - if (timeval_compare(tv2, tv1) >= 0) { + if (timeval_compare(tv1, tv2) >= 0) { return timeval_zero(); } t.tv_sec = tv2->tv_sec - tv1->tv_sec;
