From cd42a47bd8880e7a96a782dd8dc500de9912424c Mon Sep 17 00:00:00 2001 From: Zach Borboa Date: Sat, 13 Mar 2021 23:30:24 -0500 Subject: [PATCH] Make request duration more accurate --- tests/PHPCurlClass/server.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tests/PHPCurlClass/server.php b/tests/PHPCurlClass/server.php index 3db0a61..aa38e65 100644 --- a/tests/PHPCurlClass/server.php +++ b/tests/PHPCurlClass/server.php @@ -283,11 +283,19 @@ if ($test === 'http_basic_auth') { $start = microtime(true); echo '{' . "\n"; echo ' "loading": "'; + + $dots_printed = 0; while (true) { - echo '.'; - flush(); - sleep(1); + usleep(1000000 / 100); + $elapsed = microtime(true) - $start; + $dots_to_print = floor($elapsed) - $dots_printed; + + if ($dots_to_print) { + echo str_repeat('.', $dots_to_print); + $dots_printed += $dots_to_print; + } + if ($elapsed >= $unsafe_seconds) { break; }