Skip to content

Commit 25c8ac4

Browse files
committed
Replaced microtime() with hrtime()
1 parent 646a3e6 commit 25c8ac4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

run-tests.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -682,13 +682,13 @@ function main(): void
682682
if ($test_cnt) {
683683
putenv('NO_INTERACTION=1');
684684
usort($test_files, "test_sort");
685-
$start_time = microtime(true);
685+
$start_time = hrtime(true);
686686

687687
echo "Running selected tests.\n";
688688

689689
$test_idx = 0;
690690
run_all_tests($test_files, $environment);
691-
$end_time = microtime(true);
691+
$end_time = hrtime(true);
692692

693693
if ($failed_tests_file) {
694694
fclose($failed_tests_file);
@@ -730,13 +730,13 @@ function main(): void
730730
$test_files = array_unique($test_files);
731731
usort($test_files, "test_sort");
732732

733-
$start_time = microtime(true);
733+
$start_time = hrtime(true);
734734
show_start($start_time);
735735

736736
$test_cnt = count($test_files);
737737
$test_idx = 0;
738738
run_all_tests($test_files, $environment);
739-
$end_time = microtime(true);
739+
$end_time = hrtime(true);
740740

741741
if ($failed_tests_file) {
742742
fclose($failed_tests_file);
@@ -3064,7 +3064,7 @@ function get_summary(bool $show_ext_summary): string
30643064
$summary .= '
30653065
Tests passed : ' . sprintf('%5d (%5.1f%%)', $sum_results['PASSED'], $percent_results['PASSED']) . ' ' . sprintf('(%5.1f%%)', $x_passed) . '
30663066
---------------------------------------------------------------------
3067-
Time taken : ' . sprintf('%5.3f seconds', $end_time - $start_time) . '
3067+
Time taken : ' . sprintf('%5.3f seconds', ($end_time - $start_time) / 1e9) . '
30683068
=====================================================================
30693069
';
30703070
$failed_test_summary = '';
@@ -3169,12 +3169,12 @@ function get_summary(bool $show_ext_summary): string
31693169

31703170
function show_start(int $start_time): void
31713171
{
3172-
echo "TIME START " . date('Y-m-d H:i:s', $start_time) . "\n=====================================================================\n";
3172+
echo "TIME START " . date('Y-m-d H:i:s', $start_time / 1e9) . "\n=====================================================================\n";
31733173
}
31743174

31753175
function show_end(int $end_time): void
31763176
{
3177-
echo "=====================================================================\nTIME END " . date('Y-m-d H:i:s', $end_time) . "\n";
3177+
echo "=====================================================================\nTIME END " . date('Y-m-d H:i:s', $end_time / 1e9) . "\n";
31783178
}
31793179

31803180
function show_summary(): void

0 commit comments

Comments
 (0)