等待下一毫秒的时间戳
@author : evalor <master@evalor.cn>
@param $lastTimestamp
@return float
422612
private static function tilNextMillis($lastTimestamp)
    {
        $timestamp = self::timeGen();
        while ($timestamp <= $lastTimestamp) {
            $timestamp = self::timeGen();
        }
        return $timestamp;
    }
781483
protected int newestStamp(int first, int last, int bestStampSoFar) {
        int bestStamp = bestStampSoFar;
        for (int i=first; i<=last; ++i) {
            if (stamp[i] > bestStamp) {
                bestStamp = stamp[i];
            }
        }
        return bestStamp;
    }
401109
private function hasLifetimeExpired($currentTimestamp, $periodTimestamp)
    {
        $timestamp = $this->getTimestamp();
        return (bool) ($currentTimestamp - $timestamp >= $periodTimestamp);
    }
341032
public static function fromTimestamp($timestamp)
    {
        try {
            $dateTime = new DateTime("@{$timestamp}");

            return static::fromDateTime($dateTime);
        } catch (Exception $e) {
            throw new InvalidArgumentValue('$timestamp', $timestamp, __CLASS__, $e);
        }
    }
64361
public function getUpdatedAtTimestamp(): ?int
    {
        if (!$this->hasUpdatedAt()) {
            return null;
        }

        $timestamp = strtotime($this->getUpdatedAt() . 'UTC');

        if ($timestamp === false) {
        	throw new Exception("Unable to get timestamp from \"{$this->getUpdatedAt()}\"");
        }

        return $timestamp;
    }
227356
function Last() {
        $items = $this->ToArray();
        $cnt = count($items);
        return $cnt > 0 ? $items[$cnt -1] : null;
    }
528917
public function last()
    {
        if ($this->isEmpty()) {
            return null;
        }

        $lastItem = array_slice($this->container, -1, 1);

        return current($lastItem);
    }
657672
private function checkTimestamp($timestamp)
    {
        if (! $timestamp) {
            throw new Exception(
                'Missing timestamp parameter. The parameter is required'
            );
        }

        // verify that timestamp is recentish
        $now = time();
        if (abs($now - $timestamp) > $this->timestamp_threshold) {
            throw new Exception(
                "Expired timestamp, yours $timestamp, ours $now"
            );
        }
    }
792256
public function calculate_expiry($timestamp) {
        $expiry = null;

        if (isset($this->expiredate)) {
            $expiry = $this->expiredate;
        } else if (isset($this->expireperiod)) {
            $expiry = $timestamp + $this->expireperiod;
        }

        return $expiry;
    }
335503
public function getAt(): int
    {
        if ($this->at < 0) {
            return Location::BeforeFirstRow;
        }

        if ($this->at > $this->rowCount()) {
            return Location::AfterLastRow;
        }

        return $this->at;
    }
270167
public function getElapsedTime(): float
	{
		$last = end($this->laps);

		return ($last->isRunning() ? microtime(true) : $last->getStopTime()) - $this->laps[0]->getStartTime();
	}
1043604
public function last() {
        if ($this->count()) {
            $this->current = $this->count() - 1;
            return $this->get($this->count() - 1);
        }
    }
129427
public function getTimestamp($path)
    {
        $meta = $this->getMetadata($path);

        return isset($meta['LastModified'])
            ? ['timestamp' => strtotime($meta['LastModified'])] : false;
    }
42871
public static function getMinuteTimestamp($now = null) {
        $now = $now === null ? time() : $now;
        $diff = $now % 60;
        return $now - $diff;
    }
729947
public function setTimestamp($timestamp = null)
    {
        $this->timestamp = (string)($timestamp ?? $this->modified());

        return $this;
    }
676968
public function getTimestamp(string $tplname, Sdopx $sdopx): int
    {
        $filepath = Utils::getPath($tplname, $sdopx);
        $filemtime = @filemtime($filepath);
        if ($filemtime === FALSE) {
            $filemtime = 0;
        }
        return $filemtime;
    }
180155
public static function isTimestamp($timestamp)
    {
        if (is_bool($timestamp) || !is_scalar($timestamp)) {
            return false;
        }
        return ((string)(int)$timestamp === (string)$timestamp)
        && ($timestamp <= PHP_INT_MAX)
        && ($timestamp >= ~PHP_INT_MAX);
    }