![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/mets.corals.io/wp-content/plugins/amp/src/Instrumentation/ |
<?php /** * Class StopWatchEvent. * * @package AmpProject\AmpWP */ namespace AmpProject\AmpWP\Instrumentation; /** * Record the timing of a single event. * * @package AmpProject\AmpWP * @since 2.0 * @internal */ final class StopWatchEvent { /** * Start time in milliseconds. * * @var float */ private $start; /** * End time in milliseconds. * * @var float|null */ private $end; /** * StopWatchEvent constructor. */ public function __construct() { $this->start = $this->get_now(); } /** * Stop the event. */ public function stop() { $this->end = $this->get_now(); } /** * Get the duration of the event in milliseconds. * * @return float Duration in milliseconds. */ public function get_duration() { if ( null === $this->end ) { return 0.0; } return $this->end - $this->start; } /** * Get the current time in milliseconds. * * @return float Current time in milliseconds. */ private function get_now() { return microtime( true ) * 1000; } }