@param int|null $timestamp

@return int
773093
private function getTimestamp(?int $timestamp): int
    {
        $timestamp = $timestamp ?? time();
        Assertion::greaterOrEqualThan($timestamp, 0, 'Timestamp must be at least 0.');

        return $timestamp;
    }
585229
public function setTimestamp($timestamp = null)
    {
        $this->timestamp = $timestamp;
        if ($timestamp === null) {
            $this->timestamp = new Timestamp();
        }
        return $this;
    }
772021
private static function _createFromTimestamp($timestamp) {
        // Creates an instance of the current class
        $date = new DateMilli();
        // Creates the DateTime PHP object from the given timestamp
        $dateTime = new \DateTime();
        // Check if the given timestamp is a float value (which means it contains milliseconds)
        $intValue = (int) $timestamp;
        $date->_setMilliseconds((float) ($timestamp - $intValue) * 1000);
        $timestamp = $intValue;
        if ($dateTime->setTimestamp($timestamp) === false) {
            throw new DateMilliException('Impossible to create a Date object from the given timestamp value [' . $timestamp . ']');
        }

        // Set the PHP DateTime instance property
        $date->_dateTime = $dateTime;

        return $date;
    }
657034
public static function timeFormat($timestamp = null, $format = 'Y-m-d H:i:s')
    {
        if ($timestamp === null) {
            $timestamp = time();
        } elseif (empty($timestamp)) {
            return null;
        } else {
            $timestamp = intval($timestamp);
        }
        if (strncmp($format, 'php:', 4) === 0) {
            $format = substr($format, 4);
        }
        
        return date($format, $timestamp);
    }
705473
public function convertTimestampUnixToSoap($timestamp = null) {
        if (is_null($timestamp)) {
            return strftime(self::DATETIME_FORMAT);
        }
        /**
         * @todo: timezone erachter?
         */
        return strftime(self::DATETIME_FORMAT, $timestamp);
    }
951193
function setTimestamp(?int $timestamp = null) {
        $this->timestamp = (new \DateTime(($timestamp !== null ? '@'.$timestamp : 'now')))->format('c');
        return $this;
    }
211321
public function getTimestamp() : ?int 
    {
        if ( ! $this->hasTimestamp()) {
            $this->setTimestamp($this->getDefaultTimestamp());
        }
        return $this->timestamp;
    }
1241625
private function getDosTime($timestamp = 0) {
        $timestamp = (int)$timestamp;
        $oldTZ = @date_default_timezone_get();
        date_default_timezone_set('UTC');
        $date = ($timestamp == 0 ? getdate() : getdate($timestamp));
        date_default_timezone_set($oldTZ);
        if ($date["year"] >= 1980) {
            return pack("V", (($date["mday"] + ($date["mon"] << 5) + (($date["year"]-1980) << 9)) << 16) |
                             (($date["seconds"] >> 1) + ($date["minutes"] << 5) + ($date["hours"] << 11)));
        }
        return "\x00\x00\x00\x00";
    }
333160
public function setTimestamp($timestamp)
    {
        if (self::$_immutable) {
            self::$_immutable = false;
            $newDate = clone $this;
            $newDate->setTimestamp($timestamp);
            self::$_immutable = true;

            return $newDate;
        } else {
            return parent::setTimestamp($timestamp);
        }
    }
49992
public function timestamp(): int
    {
        $request = $this->client->createRequest(Api::GET, $this->getApiUrn(['timestamp']));
        $response = $this->client->send($request);

        return (int)$response->getBody()->getContents();
    }
491413
static public function fromUnixtime($timestamp=null)
    {
        $timestamp || $timestamp = time();
        if(is_numeric($timestamp)) {
            // strftime format is different from date()
            //$value = strftime('%Y-%m-%d %H:%M:%S', $value);
            $timestamp = strftime('%Y-%m-%d %H:%M:%S', $timestamp);
        }
        return $timestamp;
    }
87830
public function hasHistory($timestamp = null)
    {
        if ($timestamp) {
            return (bool) $this->revisionAtTimestamp($timestamp);
        }

        return $this->revisions()->exists();
    }
561910
public function getGMTMidnightTstamp(int $tstamp)
    {
        $date = new \DateTime(date('Y-m-d', $tstamp));
        $date->setTimezone(new \DateTimeZone('GMT'));
        $date->setTime(0, 0, 0);

        return $date->getTimestamp();
    }
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);
        }
    }
724399
public static function fromTimestampWithMicroseconds(int $timestamp) : self
    {
        $seconds      = (int)($timestamp / 10 ** 6);
        $microseconds = $timestamp - ($seconds * 10 ** 6);

        // Ensure microseconds are right-padded with zeros because values like 012345 will be 12345 when expressed
        // as an integer, and the concatenation below will therefore shift digits left by one place.
        $microseconds = str_pad($microseconds, 6, '0', STR_PAD_LEFT);
        
        return static::fromFormat('U.u', $seconds . '.' . $microseconds);
    }
422612
private static function tilNextMillis($lastTimestamp)
    {
        $timestamp = self::timeGen();
        while ($timestamp <= $lastTimestamp) {
            $timestamp = self::timeGen();
        }
        return $timestamp;
    }
1348869
protected function sign($timestamp = null) {
		if (is_null($timestamp)) $timestamp = date('c');

		$input = sha1(print_r($this->auth, true));
		$hash = $this->hash($input, $timestamp, $this->env['security_iteration'], $this->env['security_salt']);

		return $hash;
	}