@param int $timestamp

@return int
356678
private function timecode(int $timestamp): int
    {
        return (int) floor(($timestamp - $this->getEpoch()) / $this->getPeriod());
    }
1225469
public function setThaiYear(DateTime $timestamp){
        if($this->checkThaiLocale()){
            return $timestamp->setDate(($timestamp->format('Y')+543),$timestamp->format('m'),$timestamp->format('d'));
        }else{
            return $timestamp;
        }
    }
422612
private static function tilNextMillis($lastTimestamp)
    {
        $timestamp = self::timeGen();
        while ($timestamp <= $lastTimestamp) {
            $timestamp = self::timeGen();
        }
        return $timestamp;
    }
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;
    }
454341
public function setExpireAtMilliSeconds(int $timestamp): bool
    {
        return $this->handle->pExpireAt($this->name, $timestamp);
    }
787753
public static function isValidTimeStamp($timestamp)
    {
        return ((string) (integer) $timestamp === (string) $timestamp) && $timestamp <= PHP_INT_MAX && $timestamp >= ~PHP_INT_MAX;
    }
457674
public static function fromTimestamp(int $timestamp, ?string $timezone = null): Time
    {
        $timezone = $timezone ?: date_default_timezone_get();
        assert(Validate::isTimezone($timezone), sprintf('Invalid timezone: %s', $timezone));

        $time = sprintf('%d', $timestamp);
        $dateTime = DateTimeImmutable::createFromFormat('U', $time, new DateTimeZone('UTC'));
        $dateTime = $dateTime->setTimezone(new DateTimeZone($timezone));
        $hour = (int) $dateTime->format('G');
        $minute = (int) $dateTime->format('i');
        $second = (int) $dateTime->format('s');

        return new static($hour, $minute, $second);
    }
489866
protected function hourCeil($timestamp)
    {
        return mktime(date('H', $timestamp) + 1, 0, 0, date('n', $timestamp), date('j', $timestamp), date('Y', $timestamp));
    }
549292
public static function createDateTimeFromTimestampWithMilliseconds($timestamp)
    {
        // manage negative timestamps (before unix epoch)
        if ($timestamp < 0) {
            $datetime = new \DateTime();
            $datetime = $datetime->setTimestamp($timestamp);
        } else {
            $datetime = \DateTime::createFromFormat('U.u', $timestamp, new \DateTimeZone('UTC'));

            if ($datetime == false) {
                $datetime = \DateTime::createFromFormat('U', $timestamp, new \DateTimeZone('UTC'));
            }
        }

        if ($datetime == false) {
            throw new \RuntimeException(
                sprintf('Could not create datetime from "%s": %s',
                    $timestamp,
                    print_r(\DateTime::getLastErrors(), true)
                )
            );
        }

        return $datetime;
    }
858142
private static function _timestampToUTC($timestamp)
    {
        $tz = new DateTimeZone('UTC');
        $dateTime = new DateTime($timestamp, $tz);
        $dateTime->setTimezone($tz);
        return $dateTime;
    }
137971
public function setExpireAt(int $timestamp): bool
    {
        return $this->handle->expireAt($this->name, $timestamp);
    }
875901
public static function isoDate($timestamp = null)
    {
        $tz = date_default_timezone_get();
        date_default_timezone_set('UTC');

        if (is_null($timestamp)) {
            $timestamp = time();
        }

        $returnValue = str_replace(
            '+00:00', '.0000000Z', date('c', $timestamp)
        );
        date_default_timezone_set($tz);

        return $returnValue;
    }
1359551
private function getTimestamp($timestamp)
    {
        if ($timestamp instanceof \DateTime) {
            $timestamp = $timestamp->getTimestamp();
        }

        if ((int)$timestamp != $timestamp) {
            throw new ResqueSchedulerInvalidTimestampException(
                'The supplied timestamp value could not be converted to an integer.'
            );
        }

        return (int)$timestamp;
    }
1182747
public static function unix2dos($timestamp = 0)
    {
        $timestamp = ! $timestamp ? getdate() : getdate($timestamp);

        if ($timestamp['year'] < 1980)
        {
            return (1 << 21 | 1 << 16);
        }

        $timestamp['year'] -= 1980;

        return ($timestamp['year'] << 25 | $timestamp['mon'] << 21 |
            $timestamp['mday'] << 16 | $timestamp['hours'] << 11 |
            $timestamp['minutes'] << 5 | $timestamp['seconds'] >> 1);
    }
49992
public function timestamp(): int
    {
        $request = $this->client->createRequest(Api::GET, $this->getApiUrn(['timestamp']));
        $response = $this->client->send($request);

        return (int)$response->getBody()->getContents();
    }
611455
public function getDelayedTimestampSize($timestamp)
    {
        $timestamp = $this->toTimestamp($timestamp);
        return $this->redis->llen('delayed:' . $timestamp, $timestamp);
    }
64901
public static function getISO8601($timestamp=false) {
        if ( $timestamp === false ) {
            $dt = new \DateTime();
        } else {
            $format = 'Y-m-d H:i:s';
            $dt = \DateTime::createFromFormat($format, $timestamp);
        }

        // 2017-08-16T16:26:31-1000
        $iso8601 = $dt->format(\DateTime::ISO8601);

        // 2017-08-20T10:34:05.000Z
        $iso8601 = str_replace('-1000','.000Z',$iso8601);

        return $iso8601;
    }