Skip to content

Commit df3d582

Browse files
committed
Fix timestamp for displaying start and end time
1 parent 25c8ac4 commit df3d582

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

run-tests.php

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

687688
echo "Running selected tests.\n";
@@ -730,6 +731,7 @@ function main(): void
730731
$test_files = array_unique($test_files);
731732
usort($test_files, "test_sort");
732733

734+
$start_timestamp = time();
733735
$start_time = hrtime(true);
734736
show_start($start_time);
735737

@@ -755,7 +757,7 @@ function main(): void
755757

756758
compute_summary();
757759

758-
show_end($end_time);
760+
show_end($start_timestamp, $start_time, $end_time);
759761
show_summary();
760762

761763
save_results($output_file, /* prompt_to_save_results: */ true);
@@ -3167,14 +3169,14 @@ function get_summary(bool $show_ext_summary): string
31673169
return $summary;
31683170
}
31693171

3170-
function show_start(int $start_time): void
3172+
function show_start(int $start_timestamp): void
31713173
{
3172-
echo "TIME START " . date('Y-m-d H:i:s', $start_time / 1e9) . "\n=====================================================================\n";
3174+
echo "TIME START " . date('Y-m-d H:i:s', $start_timestamp) . "\n=====================================================================\n";
31733175
}
31743176

3175-
function show_end(int $end_time): void
3177+
function show_end(int $start_timestamp, float $start_time, float $end_time): void
31763178
{
3177-
echo "=====================================================================\nTIME END " . date('Y-m-d H:i:s', $end_time / 1e9) . "\n";
3179+
echo "=====================================================================\nTIME END " . date('Y-m-d H:i:s', $start_timestamp + (int)(($end_time - $start_time)/1e9)) . "\n";
31783180
}
31793181

31803182
function show_summary(): void

0 commit comments

Comments
 (0)