Get the difference between the current timestamp in microseconds and the given timestamp.

@param number $start
Timestamp to calculate the different with.

@return number Difference between the current timestamp in microseconds and the given timestamp.
182228
public static function getDuration($start)
    {
        $time = microtime();
        $time = explode(' ', $time);
        $time = $time[1] + $time[0];
        $finish = $time;
        
        return round(($finish - $start), 4);
    }
1174103
public function getDifferenceInYears($compare = null)
        {
            if (!$compare) {
                $compare = new Date(null, $this->getTimezone());
            }

            return $this->diff($compare)->format('%r%y');
        }
996900
private function getCurrentTime()
    {
        list ($msec, $sec) = explode(" ", microtime());
        return (float)$msec + (float)$sec;
    }
310447
public function getDuration(): float {
        return $this->duration ? $this->duration : microtime(true) - $this->startTime;
    }
631949
public static function GetCurrentDateTime( $context )
	{
		$res = DateTimeValue::fromDate( false, new \DateTime( "@" . $context->RunningContext->now ) );
		$res->Value->microseconds = 0;
		$res->IsLocal = false;
		return $res;
	}
705380
public function getDifferenceInDays($compare = null)
        {
            if (!$compare) {
                $compare = new Date(null, $this->getTimezone());
            }

            return $this->diff($compare)->format('%r%a');
        }
86501
public function getDuration($from = Timer::START, $to = Timer::STOP) {
        $from = $this->getCheckpoint($from);
        $to = $this->getCheckpoint($to);

        if ($from === null) {
            return 0;
        }

        if ($to === null) {
            $to = microtime(true);
        }

        return abs($to - $from);
    }
115484
public static function seconds(int $step = 1, int $start = 0, int $end = 60) : array
    {
        return Date::_range($step, $start, $end);
    }
978720
function DaysToNow(){ // as datetime object returns difference in seconds
		if(empty(self::$dtnow)){
			self::$dtnow=new \DateTime();
			}
		//Get difference
		$diff=$this->diff(self::$dtnow);
		$diff_days =$diff->format('%r').($diff->days);
		return $diff_days;
		}
320691
protected function getElapsedTime($start)
    {
        if ($this->elapsedTimeMethod === null) {
            $reflection = new ReflectionClass($this->getConnect());
            $this->elapsedTimeMethod = $reflection->getMethod('getElapsedTime');
            $this->elapsedTimeMethod->setAccessible(true);
        }

        return $this->elapsedTimeMethod->invoke($this->getConnect(), $start);
    }
1138768
protected function dateIntervalToSeconds($interval): int
    {
        $now = time();
        $dt = new \DateTime();
        $dt->add($interval);
        $ts = $dt->getTimestamp();
        $diff = $ts - $now;
        return $diff;
    }
1163557
public static function timestamp($time = null): int
    {
        if ($time instanceof \DateTime) {
            return $time->format('U');
        }

        $time = time();

        if ($time !== null) {
            $time = is_numeric($time) ? (int) $time : strtotime($time);
        }

        return $time;
    }
553764
protected function getStartRowNumber($start)
    {
        if( $this->start !== NULL )
        {
            $start = (int) $this->start;
        }

        if( empty($start) && ! is_numeric($start) )
        {
            return ! is_numeric($segment = URI::segment(-1)) ? 0 : $segment;
        }
        
        return ! is_numeric($start) ? 0 : $start;
    }
1065692
public function getTimestampDifference($time = null)
    {
        $time = (is_null($time)) ? $this->getCurrentTimestamp() : $time;

        return ($time - $this->initialTimestamp);
    }
699260
public static Duration diff(Date start, Date end) {
		return fromMillis(end.getTime() - start.getTime());
	}
1195977
public final function getDifferenceYears( $dt = null, bool $abs = true ) : int
   {

      $dt = $dt ?: static::Now( $this->getTimezone() );

      return (int) $this->diff( $dt, $abs )->format( '%r%y' );

   }
1297956
static public function get_time() {
        // By David Maciel (jdmaciel@gmail.com)
        list($microsecond, $second) = explode(" ", \microtime());
        // remove '0.' from the beginning and trailing zeros(2) from the end
        $microsecond = substr($microsecond, 2, -2);
        return (int) $second . $microsecond;
    }