Returns true this instance happened within the specified interval

@param string|int $timeInterval the numeric value with space then time type.
Example of valid types: 6 hours, 2 days, 1 minute.
@return bool
971596
public function wasWithinLast($timeInterval)
    {
        $now = new static();
        $interval = $now->copy()->modify('-' . $timeInterval);
        $thisTime = $this->format('U');

        return $thisTime >= $interval->format('U') && $thisTime <= $now->format('U');
    }
76456
public static function compareDateIntervals(DateInterval $a, DateInterval $b)
    {
        $current = Carbon::now();
        $passed = $current->copy()->add($b);
        $current->add($a);

        if ($current < $passed) {
            return -1;
        } elseif ($current > $passed) {
            return 1;
        }

        return 0;
    }
209814
public static function intervalToTime(DateInterval $interval)
    {
        $time = null;

        if (!is_null($interval)) {
            $format = property_exists(get_class($interval), 'u') ? '%H:%I:%S.%U' : '%H:%I:%S';
            $time = $interval->format($format);
        }

        return $time;
    }
663866
public static function timeDifferent($time1, $time2)
    {
        $intTime1 = $this->unixTime($time1);
        $intTime2 = $this->unixTime($time2);
        $timeDiff = $intTime2 - $intTime1;

        return $timeDiff;
    }
1280383
public function setInterval($interval)
    {
        $this->interval = $interval instanceof DateInterval ? $interval : new DateInterval($interval);
        return $this;
    }
68685
public function run($checkInterval = self::CHECK_INTERVAL)
    {
        $this->startNext();

        $interval = (int) ($checkInterval * 1000000);
        while ($this->poll()) {
            usleep($interval);
        }

        return $this->isSuccessful();
    }
248087
public function isDateWillComeIn($interval)
    {
        if (!($interval instanceof \DateInterval)) {
            $interval = new \DateInterval((string) $interval);
        }
        $now = new \DateTime('now');
        return 0 === $this->diff($now->add($interval))->invert;
    }
182298
public static function turnDateIntervalToSeconds(DateInterval $dateInterval)
    {
        return $dateInterval->y * 365 * 24 * 3600
            + $dateInterval->m * 30 * 24 * 3600
            + $dateInterval->d * 24 * 3600
            + $dateInterval->h * 3600
            + $dateInterval->i * 60
            + $dateInterval->s;
    }
965145
public function getFrame($interval)
	{
		if ( ! $interval instanceof TimeInterval)
		{
			$interval = new TimeInterval($interval);
		}
		
		if ($interval->getSeconds() > $this->getDuration())
		{
			throw new \OutOfRangeException('The interval may not be a more than '.$this->getDuration());
		}
		
		$frame = new Frame($this->getFilePath(), $this->getService());
		$frame->addFilter(new SimpleFilter(['seek_start' => $interval->__toString()]), 99);
		
		return $frame;
	}
60601
public static function time(Time $time, Time $interval = null)
    {
        $secInDay = Time::days(1)->sec;
        $interval = $interval ? $interval->sec : $secInDay;

        return static::deg($time->sec / $interval * 360);
    }
848601
public function isTimeIncluded($timeStamp)
    {
        if ($this->getValue('excludeAll')) {
            return false;
        }

        // 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);
        $wday = (int) $date->format('N');

        return false == $this->isDayExcluded($wday);
    }
1280199
public static function instance(DateInterval $di)
    {
        if (self::wasCreatedFromDiff($di)) {
            throw new InvalidArgumentException('Can not instance a Interval object created from DateTime::diff().');
        }

        $instance = new static($di->y, $di->m, 0, $di->d, $di->h, $di->i, $di->s);
        $instance->invert = $di->invert;
        $instance->days = $di->days;

        return $instance;
    }
756541
public function diff(TimePoint $timepoint)
    {
        $interval = $this->date->diff($timepoint->date);
        $intervalSpec = $this->dateIntervalToIntervalSpec($interval);

        return new TimeInterval($intervalSpec);
    }
703747
public static function instance(DateInterval $di)
    {
        $microseconds = $di->f;
        $instance = new static(static::getDateIntervalSpec($di));
        if ($microseconds) {
            $instance->f = $microseconds;
        }
        $instance->invert = $di->invert;
        foreach (['y', 'm', 'd', 'h', 'i', 's'] as $unit) {
            if ($di->$unit < 0) {
                $instance->$unit *= -1;
            }
        }

        return $instance;
    }
27747
public function formatInterval(\DateInterval $dateInterval): string
    {
        $format = 'P';

        if (0 < $dateInterval->y) {
            $format .= $dateInterval->y.'Y';
        }

        if (0 < $dateInterval->m) {
            $format .= $dateInterval->m.'M';
        }

        if (0 < $dateInterval->d) {
            $format .= $dateInterval->d.'D';
        }

        if (0 < $dateInterval->h || 0 < $dateInterval->i || 0 < $dateInterval->s) {
            $format .= 'T';
        }

        if (0 < $dateInterval->h) {
            $format .= $dateInterval->h.'H';
        }

        if (0 < $dateInterval->i) {
            $format .= $dateInterval->i.'M';
        }

        if (0 < $dateInterval->s) {
            $format .= $dateInterval->s.'S';
        }

        return $format;
    }
673081
protected function _getInterval($interval) {
		if ($interval !== null) {
			return $interval;
		} elseif (!empty($this->params['interval'])) {
			return $this->params['interval'];
		} else {
			return '1 day';
		}
	}
915443
public function isFollowedByAtMidnight(DateTimeImmutableInterval $other): bool
	{
		return (
			Utils::isSameDate(
				$this->getRight()->getValue(),
				$other->getLeft()->getValue()->modify('-1 day')
			)
			&& $this->getRight()->getValue()->format('H:i:s') === '23:59:59'
			&& $other->getLeft()->getValue()->format('H:i:s') === '00:00:00'
		);
	}