function Duration::asString
Same name in this branch
- 11.1.x vendor/phpunit/php-timer/src/Duration.php \SebastianBergmann\Timer\Duration::asString()
File
-
vendor/
phpunit/ phpunit/ src/ Event/ Value/ Telemetry/ Duration.php, line 65
Class
- Duration
- @psalm-immutable
Namespace
PHPUnit\Event\TelemetryCode
public function asString() : string {
$seconds = $this->seconds();
$minutes = 0;
$hours = 0;
if ($seconds > 60 * 60) {
$hours = floor($seconds / 60 / 60);
$seconds -= $hours * 60 * 60;
}
if ($seconds > 60) {
$minutes = floor($seconds / 60);
$seconds -= $minutes * 60;
}
return sprintf('%02d:%02d:%02d.%09d', $hours, $minutes, $seconds, $this->nanoseconds());
}