| Server IP : 217.11.249.137 / Your IP : 216.73.216.54 Web Server : Apache System : FreeBSD triton.blueboard.cz 13.5-STABLE FreeBSD 13.5-STABLE stable/13-a3d32f9e6 GENERIC amd64 User : www ( 80) PHP Version : 8.0.30 Disable Function : ini_restore, show_source, socket_select, socket_create_listen, socket_create_pair, socket_listen, socket_strerror, shell_exec, proc_nice, proc_terminate, readlink, symlink, link, pfsocketopen, ini_alter, dl, pcntl_exec, pcntl_fork, pcntl_signal, pcntl_waitpid, pcntl_wexitstatus, pcntl_wifexited, pcntl_wifsignaled, pcntl_wifsignaled, pcntl_wifstoped, pcntl_wifstopsig, pcntl_wtermsig, socket_accept, socket_bind, socket_create, socket_create_listen, popen, zlib_decode MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /data/www/24781/extramagazin_cz/www/wp-content/plugins/amp/src/Instrumentation/ |
Upload File : |
<?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;
}
}