Skip to content

Commit

Permalink
Fix deprecation conversion float to int (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhelias committed Jun 3, 2024
1 parent f3fcdd7 commit 2b88f92
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Helper/Format.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,18 @@ public static function memory(int $bytes): string
public static function time(float $msec): string
{
if ($msec > 1000 * 60) {
return \sprintf("%d mn %d sec", $msec / 60000, \round(($msec % 60000) / 60000 * 60));
return \sprintf(
"%d mn %d sec",
$msec / 60000,
\round((\floor($msec) % 60000) / 60000 * 60)
);
}
if ($msec > 1000) {
return \sprintf('%d sec %d ms', $msec / 1000, \round($msec % 1000));
return \sprintf(
"%d sec %d ms",
$msec / 1000,
\round((\floor($msec) % 1000) / 1000)
);
}
return \round($msec) . ' ms';
}
Expand Down

0 comments on commit 2b88f92

Please sign in to comment.