<?php

namespace Blazemedia\Affiliation\Utils;

class TimeTracker {

    private static $instance = null;

    private $start;
    private $end;

    
    public function setStartTime() {

        $this->start = microtime(true);
    }


    public function setEndTime() {
        
        $this->end = microtime(true);
    }


    public function getMSInterval() {

        return  intval( ( $this->end - $this->start ) * 1000 );  //millisecondi 
    }





    public static function getInstance()
    {
        if(self::$instance == null) {
        
            $c = __CLASS__;
            self::$instance = new $c;
        }
       
        return self::$instance;
    }
 
}
