From 0e829bf21b0a708091fe76eb61c2d74cda155403 Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Wed, 1 Jun 2022 20:13:37 +0300 Subject: src/examples/benchmark{,_https}: simplified time calculation --- src/examples/benchmark.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/examples/benchmark.c') diff --git a/src/examples/benchmark.c b/src/examples/benchmark.c index b5598b1b..1e8361a3 100644 --- a/src/examples/benchmark.c +++ b/src/examples/benchmark.c @@ -86,13 +86,8 @@ completed_callback (void *cls, return; gettimeofday (&tve, NULL); - delta = 0; - if (tve.tv_usec >= tv->tv_usec) - delta += (tve.tv_sec - tv->tv_sec) * 1000000LL - + (tve.tv_usec - tv->tv_usec); - else - delta += (tve.tv_sec - tv->tv_sec) * 1000000LL - - tv->tv_usec + tve.tv_usec; + delta = ((uint64_t) (tve.tv_sec - tv->tv_sec)) * 1000000LL + + (uint64_t) tve.tv_usec - (uint64_t) tv->tv_usec; if (delta < SMALL) small_deltas[delta]++; else -- cgit v1.2.3