public function result()
    {
        if (is_null($this->start_time))
        {
            throw new \Exception('Timer: start method not called !');
        }
        else if (is_null($this->end_time))
        {
            throw new \Exception('Timer: stop method not called !');
        }

        if ($this->result==null)
        {
            list($endTimeMicroSeconds, $endTimeSeconds) = explode(' ', $this->end_time);
            list($startTimeMicroSeconds, $startTimeSeconds) = explode(' ', $this->start_time);

            $differenceInMilliSeconds =  ((float)$endTimeSeconds - (float)$startTimeSeconds)*1000;

            $this->result = round(($differenceInMilliSeconds + ((float)$endTimeMicroSeconds *1000)) -  (float)$startTimeMicroSeconds *1000);
        }
        return $this->result;
    }
public function result()
    {
        if (is_null($this->start_time))
        {
            throw new \Exception('Timer: start method not called !');
        }
        else if (is_null($this->end_time))
        {
            throw new \Exception('Timer: stop method not called !');
        }

        if ($this->result==null)
        {
            list($endTimeMicroSeconds, $endTimeSeconds) = explode(' ', $this->end_time);
            list($startTimeMicroSeconds, $startTimeSeconds) = explode(' ', $this->start_time);

            $differenceInMilliSeconds =  ((float)$endTimeSeconds - (float)$startTimeSeconds)*1000;

            $this->result = round(($differenceInMilliSeconds + ((float)$endTimeMicroSeconds *1000)) -  (float)$startTimeMicroSeconds *1000);
        }
        return $this->result;
    }
public function result ( ) { if ( is_null ( $ this -> start_time ) ) { throw new \ Exception ( 'Timer: start method not called !' ) ; } else if ( is_null ( $ this -> end_time ) ) { throw new \ Exception ( 'Timer: stop method not called !' ) ; } if ( $ this -> result == null ) { list ( $ endTimeMicroSeconds , $ endTimeSeconds ) = explode ( ' ' , $ this -> end_time ) ; list ( $ startTimeMicroSeconds , $ startTimeSeconds ) = explode ( ' ' , $ this -> start_time ) ; $ differenceInMilliSeconds = ( ( float ) $ endTimeSeconds - ( float ) $ startTimeSeconds ) * 1000 ; $ this -> result = round ( ( $ differenceInMilliSeconds + ( ( float ) $ endTimeMicroSeconds * 1000 ) ) - ( float ) $ startTimeMicroSeconds * 1000 ) ; } return $ this -> result ; }
Calculate difference between start and end time of event and return in milli-seconds.
@throws \Exception
@return number time difference in milliseconds between start and end time of event
Calculate difference between start and end time of event and return in milli - seconds .