Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Duration.php

function Duration::asString

Same name in this branch
  1. 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\Telemetry

Code

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());
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal