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

Breadcrumb

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

function Timer::stop

Same name in this branch
  1. 11.1.x core/lib/Drupal/Component/Utility/Timer.php \Drupal\Component\Utility\Timer::stop()

Throws

NoActiveTimerException

File

vendor/phpunit/php-timer/src/Timer.php, line 30

Class

Timer

Namespace

SebastianBergmann\Timer

Code

public function stop() : Duration {
    if (empty($this->startTimes)) {
        throw new NoActiveTimerException('Timer::start() has to be called before Timer::stop()');
    }
    return Duration::fromNanoseconds((double) hrtime(true) - array_pop($this->startTimes));
}
RSS feed
Powered by Drupal