Skip to content

Commit 65d36d4

Browse files
committed
Replaced microtime() with hrtime()
1 parent 628a3b1 commit 65d36d4

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
@@ -708,13 +708,13 @@ function main(): void
708708
if ($test_cnt) {
709709
putenv('NO_INTERACTION=1');
710710
usort($test_files, "test_sort");
711-
$start_time = microtime(true);
711+
$start_time = hrtime(true);
712712

713713
echo "Running selected tests.\n";
714714

715715
$test_idx = 0;
716716
run_all_tests($test_files, $environment);
717-
$end_time = microtime(true);
717+
$end_time = hrtime(true);
718718

719719
if ($failed_tests_file) {
720720
fclose($failed_tests_file);
@@ -762,13 +762,13 @@ function main(): void
762762
$test_files = array_unique($test_files);
763763
usort($test_files, "test_sort");
764764

765-
$start_time = microtime(true);
765+
$start_time = hrtime(true);
766766
show_start($start_time);
767767

768768
$test_cnt = count($test_files);
769769
$test_idx = 0;
770770
run_all_tests($test_files, $environment);
771-
$end_time = microtime(true);
771+
$end_time = hrtime(true);
772772

773773
if ($failed_tests_file) {
774774
fclose($failed_tests_file);
@@ -3117,7 +3117,7 @@ function get_summary(bool $show_ext_summary): string
31173117
$summary .= '
31183118
Tests passed : ' . sprintf('%5d (%5.1f%%)', $sum_results['PASSED'], $percent_results['PASSED']) . ' ' . sprintf('(%5.1f%%)', $x_passed) . '
31193119
---------------------------------------------------------------------
3120-
Time taken : ' . sprintf('%5.3f seconds', $end_time - $start_time) . '
3120+
Time taken : ' . sprintf('%5.3f seconds', ($end_time - $start_time) / 1e9) . '
31213121
=====================================================================
31223122
';
31233123
$failed_test_summary = '';
@@ -3222,12 +3222,12 @@ function get_summary(bool $show_ext_summary): string
32223222

32233223
function show_start($start_time): void
32243224
{
3225-
echo "TIME START " . date('Y-m-d H:i:s', $start_time) . "\n=====================================================================\n";
3225+
echo "TIME START " . date('Y-m-d H:i:s', $start_time / 1e9) . "\n=====================================================================\n";
32263226
}
32273227

32283228
function show_end($end_time): void
32293229
{
3230-
echo "=====================================================================\nTIME END " . date('Y-m-d H:i:s', $end_time) . "\n";
3230+
echo "=====================================================================\nTIME END " . date('Y-m-d H:i:s', $end_time / 1e9) . "\n";
32313231
}
32323232

32333233
function show_summary(): void

0 commit comments

Comments
 (0)