Skip to content

Commit dd2ce2c

Browse files
committed
Improve time formatting
1 parent e781340 commit dd2ce2c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Cli/BrefSpinner.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ private function overwrite(string $message): void
164164

165165
private function formatTime(int|float $secs): string
166166
{
167-
return ((int) floor($secs)) . 's';
167+
// If < 100s, show seconds
168+
if ($secs < 100) {
169+
return ((int) floor($secs)) . 's';
170+
}
171+
// else show minutes
172+
$mins = (int) floor($secs / 60);
173+
$secs = (int) floor($secs % 60);
174+
return $mins . 'm ' . $secs . 's';
168175
}
169176
}

0 commit comments

Comments
 (0)