src/Cronner/Tasks/Parameters.php
public function isNextPeriod(DateTimeInterface $now, DateTimeInterface $lastRunTime = NULL) : bool
	{
		if (
			$lastRunTime !== NULL
			&& !$lastRunTime instanceof \DateTimeImmutable
			&& !$lastRunTime instanceof \DateTime
		) {
			throw new InvalidArgumentException;
		}

		if (isset($this->values[static::PERIOD]) && $this->values[static::PERIOD]) {
			// Prevent run task on next cronner run because of a few seconds shift
			$now = Nette\Utils\DateTime::from($now)->modifyClone('+5 seconds');

			return $lastRunTime === NULL || $lastRunTime->modify('+ ' . $this->values[static::PERIOD]) <= $now;
		}

		return TRUE;
	}
public function isNextPeriod(DateTimeInterface $now, DateTimeInterface $lastRunTime = NULL) : bool
	{
		if (
			$lastRunTime !== NULL
			&& !$lastRunTime instanceof \DateTimeImmutable
			&& !$lastRunTime instanceof \DateTime
		) {
			throw new InvalidArgumentException;
		}

		if (isset($this->values[static::PERIOD]) && $this->values[static::PERIOD]) {
			// Prevent run task on next cronner run because of a few seconds shift
			$now = Nette\Utils\DateTime::from($now)->modifyClone('+5 seconds');

			return $lastRunTime === NULL || $lastRunTime->modify('+ ' . $this->values[static::PERIOD]) <= $now;
		}

		return TRUE;
	}
public function isNextPeriod ( DateTimeInterface $ now , DateTimeInterface $ lastRunTime = NULL ) : bool { if ( $ lastRunTime !== NULL && ! $ lastRunTime instanceof \ DateTimeImmutable && ! $ lastRunTime instanceof \ DateTime ) { throw new InvalidArgumentException ; } if ( isset ( $ this -> values [ static :: PERIOD ] ) && $ this -> values [ static :: PERIOD ] ) { // Prevent run task on next cronner run because of a few seconds shift $ now = Nette \ Utils \ DateTime :: from ( $ now ) -> modifyClone ( '+5 seconds' ) ; return $ lastRunTime === NULL || $ lastRunTime -> modify ( '+ ' . $ this -> values [ static :: PERIOD ] ) <= $ now ; } return TRUE ; }
Returns true if current time is next period of invocation.
Returns true if current time is next period of invocation .