Skip to content

Commit 7644bd0

Browse files
committed
More precise elapsed time if it's a low number
1 parent 1220d8e commit 7644bd0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Command/InceptionResult.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,15 @@ public function getEditorModeInsteadOfFile(): ?string
103103
public function handleReturn(int $exitCode, ?int $peakMemoryUsageBytes, float $analysisStartTime): int
104104
{
105105
if ($this->getErrorOutput()->isVerbose()) {
106+
$elapsedTime = round(microtime(true) - $analysisStartTime, 2);
107+
if ($elapsedTime < 10) {
108+
$elapsedTimeString = sprintf('%.2f seconds', $elapsedTime);
109+
} else {
110+
$elapsedTimeString = $this->formatDuration((int) $elapsedTime);
111+
}
106112
$this->getErrorOutput()->writeLineFormatted(sprintf(
107113
'Elapsed time: %s',
108-
$this->formatDuration((int) round(microtime(true) - $analysisStartTime)),
114+
$elapsedTimeString,
109115
));
110116
}
111117

0 commit comments

Comments
 (0)