dovecot-2.0: timeval_diff_*() fixes.
dovecot at dovecot.org
dovecot at dovecot.org
Thu Aug 13 00:27:59 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/6ff08c7c9f03
changeset: 9771:6ff08c7c9f03
user: Timo Sirainen <tss at iki.fi>
date: Wed Aug 12 17:26:56 2009 -0400
description:
timeval_diff_*() fixes.
diffstat:
1 file changed, 2 insertions(+), 11 deletions(-)
src/lib/time-util.c | 13 ++-----------
diffs (30 lines):
diff -r 306e450a3515 -r 6ff08c7c9f03 src/lib/time-util.c
--- a/src/lib/time-util.c Wed Aug 12 17:06:07 2009 -0400
+++ b/src/lib/time-util.c Wed Aug 12 17:26:56 2009 -0400
@@ -20,16 +20,7 @@ int timeval_cmp(const struct timeval *tv
int timeval_diff_msecs(const struct timeval *tv1, const struct timeval *tv2)
{
- time_t secs;
- int usecs;
-
- secs = tv1->tv_sec - tv2->tv_sec;
- usecs = tv1->tv_usec - tv2->tv_usec;
- if (usecs < 0) {
- secs++;
- usecs += 1000000;
- }
- return (secs * 1000) + (usecs/1000);
+ return timeval_diff_usecs(tv1, tv2) / 1000;
}
long long timeval_diff_usecs(const struct timeval *tv1,
@@ -41,7 +32,7 @@ long long timeval_diff_usecs(const struc
secs = tv1->tv_sec - tv2->tv_sec;
usecs = tv1->tv_usec - tv2->tv_usec;
if (usecs < 0) {
- secs++;
+ secs--;
usecs += 1000000;
}
return ((long long)secs * 1000000ULL) + usecs;
More information about the dovecot-cvs
mailing list