isDue

@param string $currentTime
@param string $timeZone

@return  bool

@since  3.5.3
763968
public function isDue($currentTime = 'now', $timeZone = null): bool
    {
        return $this->expression->isDue($currentTime, $timeZone);
    }
634579
public function isDue(Schedulable $scheduler)
    {
        /** @var \Indatus\Dispatcher\Drivers\DateTime\ScheduleInterpreter $interpreter */
        $interpreter = App::make('Indatus\Dispatcher\Drivers\DateTime\ScheduleInterpreter', [$scheduler]);

        /** @var \Illuminate\Contracts\Logging\Log $logger */
        $logger = App::make('Illuminate\Contracts\Logging\Log');

        try {
            return $interpreter->isDue();
        } catch (Exception $e) {
            $logger->error($e);
        }

        return false;
    }
565915
public static function isTimezone($value): bool
    {
        if ($value instanceof DateTimeZone) {
            return true;
        }

        if (!static::isStringCastable($value)) {
            return false;
        }

        return self::isValidTimezone((string) $value);
    }
1350584
public function needToUpdate($currentTimestamp)
    {
        return ($this->hasLifetimeExpired($currentTimestamp, self::SERVER_INFO_UPDATE_PERIOD)
            || !$this->isServerTimeValid($currentTimestamp));
    }
1226677
public function isPublished(DateTime $time = null)
    {
        $timestamp = $time ? $time->getTimestamp() : time();

        return $this->{self::ATTR_EMBARGOED_UNTIL} && $this->{self::ATTR_EMBARGOED_UNTIL} <= $timestamp;
    }
959176
public static function today($timeZone = null)
    {
        $now = null;
        $before = null;
        if ( is_null($timeZone) ) {
            $now = new \DateTime();
            $before = new \DateTime();
        } else {
            $now = new \DateTime( "now", new \DateTimeZone( $timeZone ) );
            $before = new \DateTime( "now", new \DateTimeZone( $timeZone ) );
        }
        $range = new Range( $before, $now );

        return $range;
    }
98797
public function isCreatedInLast(int $seconds = 86400, string $timezone = null): bool
    {
        if (!$this->hasCreatedAt()) {
            return false;
        }

        if ($timezone === null) {
            $timezone = 'UTC';
        }

        $date = $this->getCreatedAtDatetime($timezone);
        $now = new DateTime('now', new DateTimeZone($timezone));
        $now->modify("-{$seconds} seconds");

        return $date->getTimestamp() >= $now->getTimestamp();
    }
297528
public static function isDue($pattern, \DateTime $time = null)
  {
    if($time === null)
    {
      $time = new \DateTime();
    }
    // trim time back to last round minute
    $time->setTime($time->format('H'), $time->format('i'));

    $expression = Expression::createFromPattern($pattern);

    foreach(self::$_formats as $pos => $fmt)
    {
      if($pos > 4 && !isset($expression[$pos]))
      {
        continue;
      }

      $cmp = intval($time->format($fmt));

      $posSuccess = false;
      foreach($expression[$pos] as $part)
      {
        if($part['full'] == '*' || $part['full'] == $cmp || $posSuccess)
        {
          $posSuccess = true;
          break;
        }

        // process order: range, modulus

        // doesn't match val
        if(isset($part['val']) && $part['val'] != '*' && $cmp != $part['val'])
        {
          continue;
        }

        // out of range
        if(isset($part['min']) && isset($part['max']) && ($cmp < $part['min'] || $cmp > $part['max']))
        {
          continue;
        }

        $offset = isset($part['min']) ? $part['min'] : 0;
        if(isset($part['mod']) && (($cmp - $offset) % $part['mod']) != 0)
        {
          continue;
        }

        $posSuccess = true;
      }
      if(!$posSuccess)
      {
        return false;
      }
    }
    return true;
  }
603377
public function isExpired($now = null)
    {
        if ($now === null) { $now = time();
        }
        if (is_int($this->expires) && $this->expires < $now) {
            return true;
        } else {
            return false;
        }
    }
355817
public function validateToken(Token $token, int $currentTime = null)
    {

        $data = $this->getValidationData($currentTime);
        // @todo Add claims for validation
        return $token->validate($data);
    }
243946
public function isFuture(TimeZone $timeZone, Clock $clock = null) : bool
    {
        return $this->isAfter(LocalDateTime::now($timeZone, $clock));
    }
785248
public function isDue(DateTime $date = null)
    {
        // The execution time is being defaulted if not defined
        if (! $this->executionTime) {
            $this->at('* * * * *');
        }

        $date = $date !== null ? $date : $this->creationTime;

        if ($this->executionYear && $this->executionYear !== $date->format('Y')) {
            return false;
        }

        return $this->executionTime->isDue($date);
    }
708492
public boolean isDue() {
        if(neverUpdate)     return false;
        if(dataTimestamp == 0)
            dataTimestamp = getDataFile().file.lastModified();
        long now = System.currentTimeMillis();
        
        retryWindow = Math.max(retryWindow,SECONDS.toMillis(15));
        
        boolean due = now - dataTimestamp > DAY && now - lastAttempt > retryWindow;
        if(due) {
            lastAttempt = now;
            retryWindow = Math.min(retryWindow*2, HOURS.toMillis(1)); // exponential back off but at most 1 hour
        }
        return due;
    }
974038
static function dateTime(?\DateTimeZone $timezone = null): \DateTime
    {
        if (self::$now !== null) {
            $now = \DateTime::createFromFormat('U.u', sprintf('%.6F', self::$now));
            $now->setTimezone($timezone ?? new \DateTimeZone(date_default_timezone_get()));

            return $now;
        }

        return new \DateTime('now', $timezone);
    }
215073
public static function now(?string $timezone = null): DateTime
    {
        $timezone = $timezone ?: date_default_timezone_get();
        assert(Validate::isTimezone($timezone), sprintf('Invalid timezone: %s', $timezone));

        $dateTime = new DateTimeImmutable('now', new DateTimeZone($timezone));
        $year = (int) $dateTime->format('Y');
        $month = (int) $dateTime->format('n');
        $day = (int) $dateTime->format('j');
        $hour = (int) $dateTime->format('G');
        $minute = (int) $dateTime->format('i');
        $second = (int) $dateTime->format('s');

        return new static(
            Date::create($year, $month, $day),
            Time::create($hour, $minute, $second),
            Timezone::create($timezone)
        );
    }
1160269
public function isInDay(DateTimeInterface $now) : bool
	{
		if (($days = $this->values[static::DAYS]) !== NULL) {
			return in_array($now->format('D'), $days);
		}

		return TRUE;
	}
402115
public function isTimezone($value)
    {
        try {
            new DateTimeZone($value);
        } catch (Exception $e) {
            return false;
        } catch (Throwable $e) {
            return false;
        }

        return true;
    }