Get the number of jobs for a given timestamp in the delayed schedule.

@param DateTime|int $timestamp Timestamp
@return int Number of scheduled jobs.
553414
public static function getDelayedTimestampSize($timestamp)
	{
		$timestamp = self::toTimestamp($timestamp);
		return Resque::redis()->llen('delayed:' . $timestamp, $timestamp);
	}
1235396
public static function distance($timestamp)
    {
        $second = $timestamp - time();
        if ($second > 0) {
            $day = floor($second / (3600 * 24));
            $second = $second % (3600 * 24);//除去整天之后剩余的时间
            $hour = floor($second / 3600);
            $second = $second % 3600;//除去整小时之后剩余的时间
            $minute = floor($second / 60);
            $second = $second % 60;//除去整分钟之后剩余的时间

            $distance = [
                'day' => $day,
                'hour' => $hour,
                'minute' => $minute,
            ];
            return $distance;
        }
    }
1084148
protected function setExpiresAtFromTimeStamp($timeStamp)
    {
        $dt = new \DateTime();
        $dt->setTimestamp($timeStamp);
        $this->expiresAt = $dt;
    }
356678
private function timecode(int $timestamp): int
    {
        return (int) floor(($timestamp - $this->getEpoch()) / $this->getPeriod());
    }
105382
public function isTimeIncluded($timeStamp)
    {
        // Test the base calendar first. Only if the base calendar not already
        // excludes the time/date, continue evaluating this calendar instance.
        if (false == parent::isTimeIncluded($timeStamp)) {
            return false;
        }

        $date = $this->createDateTime($timeStamp);
        $day = (int) $date->format('j');

        return false == $this->isDayExcluded($day);
    }
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();
    }
1305898
public function getNextOccurrence($after_timestamp = null) {
		if ($after_timestamp === null) {
			$after_timestamp = time();
		}
		
		$after_timestamp = (int) $after_timestamp;

		$next = false;
		if ($this->isRecurring()) {
			$next = $this->calculateEndAfterTimestamp(1, $after_timestamp, false);
		} else if ($after_timestamp < $this->getStartTimestamp()) {
			$next = $this->getStartTimestamp();
		}

		if ($this->repeat_end_timestamp && $this->repeat_end_timestamp < $next) {
			return false;
		}

		return $next;
	}
137971
public function setExpireAt(int $timestamp): bool
    {
        return $this->handle->expireAt($this->name, $timestamp);
    }
456979
public static function removeDelayedJobFromTimestamp($timestamp, $queue, $class, $args)
    {
        $key = 'delayed:' . self::getTimestamp($timestamp);
        $item = json_encode(self::jobToHash($queue, $class, $args));
        $redis = Resque::redis();
        $count = $redis->lrem($key, 0, $item);
        self::cleanupTimestamp($key, $timestamp);

        return $count;
    }
729947
public function setTimestamp($timestamp = null)
    {
        $this->timestamp = (string)($timestamp ?? $this->modified());

        return $this;
    }
148140
public function nextItemForTimestamp($timestamp)
    {
        $timestamp = $this->getTimestamp($timestamp);
        $key = 'delayed:' . $timestamp;
        $item = json_decode($this->redis->lpop($key), true);
        $this->cleanupTimestamp($key, $timestamp);
        if(isset($item) && is_array($item)) {
            $payload = [
                'class' => $item['class'],
                'args' => $item['args']
            ];
            return new ResqueJobBase($this, $item['queue'],$payload);
        }
        return null;
    }
1245708
public function getValue($timestamp = null)
    {
        $values = $this->determine(is_int($timestamp) ? $timestamp : time());
        if (count($values) > 0 &&
            ($rate = max($values)) > 0
        ) {
            return $rate;
        }
        return $this->fallbackValue;
    }
254193
public static function create(float $timestamp = null): \DateTime
    {
        $date = static::format($timestamp);
        return new \DateTime($date);
    }
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;
    }
951193
function setTimestamp(?int $timestamp = null) {
        $this->timestamp = (new \DateTime(($timestamp !== null ? '@'.$timestamp : 'now')))->format('c');
        return $this;
    }
1087525
public function setLastVisit($timestamp = 'now')
	{
		$timestamp = new Date($timestamp);

		$query = $this->getQuery()
			->update($this->getTableName())
			->set(array('lastvisitDate' => $timestamp->toSql()))
			->whereEquals('id', $this->get('id'));

		return $query->execute();
	}
585229
public function setTimestamp($timestamp = null)
    {
        $this->timestamp = $timestamp;
        if ($timestamp === null) {
            $this->timestamp = new Timestamp();
        }
        return $this;
    }