[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.
- [libmicrohttpd] branch master updated (1b8c52f1 -> badf7560), gnunet, 2022/06/01
- [libmicrohttpd] 03/07: microhttpd.h: fixed doxy, gnunet, 2022/06/01
- [libmicrohttpd] 01/07: connection: muted compiler warning, gnunet, 2022/06/01
- [libmicrohttpd] 04/07: src/examples/*fileserver*.c: added error checking, gnunet, 2022/06/01
- [libmicrohttpd] 07/07: http_chunked_compression: fixed errors, gnunet, 2022/06/01
- [libmicrohttpd] 06/07: src/examples/demo{,_https}: added some error checking, fixed compiler warnings, gnunet, 2022/06/01
- [libmicrohttpd] 05/07: src/examples/benchmark{,_https}: simplified time calculation,
gnunet <=
- [libmicrohttpd] 02/07: src/examples: muted compiler warnings, gnunet, 2022/06/01