dovecot-1.2: Use timeval_diff_*() more.
dovecot at dovecot.org
dovecot at dovecot.org
Thu Aug 13 00:06:14 EEST 2009
details: http://hg.dovecot.org/dovecot-1.2/rev/d48640a2ab4a
changeset: 9311:d48640a2ab4a
user: Timo Sirainen <tss at iki.fi>
date: Wed Aug 12 17:06:07 2009 -0400
description:
Use timeval_diff_*() more.
diffstat:
2 files changed, 4 insertions(+), 6 deletions(-)
src/plugins/fts-squat/squat-test.c | 3 +--
src/plugins/fts/fts-storage.c | 7 +++----
diffs (37 lines):
diff -r f834d95f173a -r d48640a2ab4a src/plugins/fts-squat/squat-test.c
--- a/src/plugins/fts-squat/squat-test.c Wed Aug 12 16:59:47 2009 -0400
+++ b/src/plugins/fts-squat/squat-test.c Wed Aug 12 17:06:07 2009 -0400
@@ -186,8 +186,7 @@ int main(int argc ATTR_UNUSED, char *arg
else {
gettimeofday(&tv_end, NULL);
printf(" - Search took %.05f CPU seconds\n",
- (tv_end.tv_sec - tv_start.tv_sec) +
- (tv_end.tv_usec - tv_start.tv_usec)/1000000.0);
+ timeval_diff_usecs(&tv_end, &tv_start)/1000000.0);
printf(" - definite uids: ");
result_print(&definite_uids);
printf(" - maybe uids: ");
diff -r f834d95f173a -r d48640a2ab4a src/plugins/fts/fts-storage.c
--- a/src/plugins/fts/fts-storage.c Wed Aug 12 16:59:47 2009 -0400
+++ b/src/plugins/fts/fts-storage.c Wed Aug 12 17:06:07 2009 -0400
@@ -5,6 +5,7 @@
#include "array.h"
#include "str.h"
#include "istream.h"
+#include "time-util.h"
#include "message-parser.h"
#include "message-decoder.h"
#include "mail-namespace.h"
@@ -507,10 +508,8 @@ static void fts_build_notify(struct fts_
range = array_idx(&ctx->search_args->args->value.seqset, 0);
percentage = (ctx->mail->seq - range->seq1) * 100.0 /
(range->seq2 - range->seq1);
- msecs = (ioloop_timeval.tv_sec -
- ctx->search_start_time.tv_sec) * 1000 +
- (ioloop_timeval.tv_usec -
- ctx->search_start_time.tv_usec) / 1000;
+ msecs = timeval_diff_msecs(&ioloop_timeval,
+ &ctx->search_start_time);
secs = (msecs / (percentage / 100.0) - msecs) / 1000;
T_BEGIN {
More information about the dovecot-cvs
mailing list