function Duration::__construct
Same name in this branch
- 11.1.x vendor/phpunit/phpunit/src/Event/Value/Telemetry/Duration.php \PHPUnit\Event\Telemetry\Duration::__construct()
- 11.1.x vendor/google/protobuf/src/Google/Protobuf/Duration.php \Google\Protobuf\Duration::__construct()
File
-
vendor/
phpunit/ php-timer/ src/ Duration.php, line 36
Class
- Duration
- @psalm-immutable
Namespace
SebastianBergmann\TimerCode
private function __construct(float $nanoseconds) {
$this->nanoseconds = $nanoseconds;
$timeInMilliseconds = $nanoseconds / 1000000;
$hours = floor($timeInMilliseconds / 60 / 60 / 1000);
$hoursInMilliseconds = $hours * 60 * 60 * 1000;
$minutes = floor($timeInMilliseconds / 60 / 1000) % 60;
$minutesInMilliseconds = $minutes * 60 * 1000;
$seconds = floor(($timeInMilliseconds - $hoursInMilliseconds - $minutesInMilliseconds) / 1000);
$secondsInMilliseconds = $seconds * 1000;
$milliseconds = $timeInMilliseconds - $hoursInMilliseconds - $minutesInMilliseconds - $secondsInMilliseconds;
$this->hours = (int) $hours;
$this->minutes = $minutes;
$this->seconds = (int) $seconds;
$this->milliseconds = (int) $milliseconds;
}