HEX
Server: Apache
System: Linux sxb1plzcpnl489831.prod.sxb1.secureserver.net 4.18.0-553.52.1.lve.el8.x86_64 #1 SMP Wed May 21 15:31:29 UTC 2025 x86_64
User: j2d7uhbqfejh (10030402)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/j2d7uhbqfejh/public_html/zorgosso.nl/wp-content/plugins/404-solution/includes/Timer.php
<?php


if (!defined('ABSPATH')) {
    exit;
}

class ABJ_404_Solution_Timer {

    /** @var float */
    private $start = 0;
    
    /** @var float */
    private $stop = 0;
    
    /** @var float */
    private $elapsed = 0;
    
    /** @var bool */
    private $isRunning = false;
    
    public function __construct() {
        $this->start();
    }

    /** Also restart.
     * @return void
     */
    function start(): void {
        $this->start = microtime(true);
        $this->elapsed = 0;
        $this->isRunning = true;
    }

    /** @return float */
    function stop(): float {
        $this->stop = microtime(true);
        $elapsedThisTime = $this->stop - $this->start;
        $this->elapsed += $elapsedThisTime;
        $this->isRunning = false;
        
        return $this->getElapsedTime();
    }
    
    /** @return void */
    function restartKeepElapsed(): void {
        $this->start = microtime(true);
        $this->isRunning = true;
    }
    
    /** 
     * @return float in seconds
     */
    function getElapsedTime() {
        if ($this->isRunning) {
            return microtime(true) - $this->start + $this->elapsed;
        }
        return $this->elapsed;
    }
    
    /** @return float */
    function getStartTime(): float {
    	return $this->start;
    }

}