gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 05/07: src/examples/benchmark{,_https}: simplified time


From: gnunet
Subject: [libmicrohttpd] 05/07: src/examples/benchmark{,_https}: simplified time calculation
Date: Wed, 01 Jun 2022 21:13:33 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 0e829bf21b0a708091fe76eb61c2d74cda155403
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Wed Jun 1 20:13:37 2022 +0300

    src/examples/benchmark{,_https}: simplified time calculation
---
 src/examples/benchmark.c       | 9 ++-------
 src/examples/benchmark_https.c | 9 ++-------
 2 files changed, 4 insertions(+), 14 deletions(-)

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
diff --git a/src/examples/benchmark_https.c b/src/examples/benchmark_https.c
index ea091e90..7f391b0e 100644
--- a/src/examples/benchmark_https.c
+++ b/src/examples/benchmark_https.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

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]