Decide if the recently fetched data are still fresh enough

@param int $now current timestamp
@return bool true if no need to re-fetch, false otherwise
1905
protected function cron_has_fresh_fetch($now) {
        $recent = $this->get_last_timefetched();

        if (empty($recent)) {
            return false;
        }

        if ($now < $recent) {
            $this->cron_mtrace('The most recent fetch is reported to be in the future, this is weird!');
            return true;
        }

        if ($now - $recent > 24 * HOURSECS) {
            return false;
        }

        return true;
    }
306272
public function deleteOutdated(): bool
    {
        $keys = $this->db->keys('*');
        foreach ($keys as $key) {
            try {
                $packet = $this->getPacket($key);
                if ($packet->outdated()) {
                    $this->delete($key);
                }
            } catch (BadPacketException $e) {
                $this->delete($key);
            }
        }
        return true;
    }
1369679
public function update($current)
	{
		$this->validate();

		if ($this->files()->isEmpty()) {
			return $this->currentPictures($current);
		}

		$result = $this->mapUpdatedPictures($current);

		if (count($result) == 1 && is_array($result[0])) {
			return $result[0];
		}

		return $result;
	}
1277741
public function isCacheActual() {

        if ( !isset($this->latestCachingTime) ) {
            return false;
        }

        return
            ( (time() - $this->latestCachingTime)
              > self::ONE_DAY_IN_SECONDS );
    }
1240710
public function validateDate()
    {
        if (
            ($from = $this->getAvailableFrom()) &&
            ($till = $this->getAvailableTill()) &&
            $from->InPast() &&
            $till->InFuture()
        ) {
            return true;
        }

        return false;
    }
238152
public function expired()
    {
        // Update if empty
        if (empty($this->entries)) {
            return true;
        }

        // Check timestamps
        if ($this->timestampManager) {
            return $this->timestampManager->check($this->getTimestamp());
        }

        return false;
    }
286060
public function clearExpired(&$Data)
    {
        if (!is_array($Data)) {
            return false;
        }
        $Cleared = false;
        $Updated = [];
        foreach ($Data as $Key => $Value) {
            if (is_array($Value)) {
                foreach ($Value as &$SubValue) {
                    if (is_array($SubValue)) {
                        if ($this->clearExpired($SubValue)) {
                            $Cleared = true;
                        }
                    }
                }
                unset($SubValue);
            }
            if (!is_array($Value) || !isset($Value['Time']) || $Value['Time'] > time()) {
                $Updated[$Key] = $Value;
            } else {
                $Cleared = true;
            }
        }
        $Data = $Updated;
        return $Cleared;
    }
962411
public function isFresh($name, $time)
    {
        $file = $this->findTemplateFile($name);
        $fresh = (filemtime($file) <= $time);
        return $fresh;
    }
116334
protected function isUtcValid($utc, $now, $rp) {
        if( 'forever' == $rp) {
            $nowDate = date('Y-m-d', strtotime($now));
            if(strtotime($utc) >= strtotime($nowDate)) {
                return false;
            }
        } 
        if( 'years_5' == $rp) {
            $min = date('i', strtotime($now));
            $minutes = $min > 45 ? 45 : ( $min > 30 ? 30 : ( $min > 15 ? 15 : '00') );       
            $nowLimit = date('Y-m-d', strtotime($now)) . "T" . date('H', strtotime($now)) . ":$minutes:00Z";
            if(strtotime($utc) >= strtotime($nowLimit)) {
                return false;
            }
        }
        return true;
    }
805638
def check_if_ok_to_update(self):
        """"""
        current_time = int(time.time())
        last_refresh = self.last_refresh
        if last_refresh is None:
            last_refresh = 0
        if current_time >= (last_refresh + self.refresh_rate):
            return True
        return False
678610
protected function isSaved(): bool
    {
        return $this->filesystem->has($this->path)
            && $this->filesystem->getTimestamp($this->path) > $this->file->getUpdatedAt();
    }
1168361
public function shouldSample()
    {
        // We will store the microtime timestamp in the cache because some
        // cache implementations will not let you use expiry for anything less
        // than 1 minute
        if ($item = $this->cache->getItem($this->key)) {
            if ((float) $item->get() > microtime(true)) {
                return false;
            }
        }

        $item = new $this->cacheItemClass($this->key);
        $item->set(microtime(true) + 1.0 / $this->rate);

        // TODO: what if the cache fails to save?
        $this->cache->save($item);

        return true;
    }
549575
public function deleteOutdated(): bool
    {
        $sql =  'DELETE FROM `' . $this->table . '`'
                . ' WHERE `' . $this->savetimeField . '`<'
                . '(' . time() . '-`' . $this->timestampField . '`)';
        return $this->db->query($sql);
    }
227556
function MustUseCache()
    {
        if ($this->cacheLifetime == 0)
        {
            return false;
        }
        if (!File::Exists($this->file))
        {
            return false;
        }
        $now = Date::Now();
        $lastMod = File::GetLastModified($this->file);
        if ($now->TimeStamp() - $lastMod->TimeStamp() < $this->cacheLifetime)
        {
            return true;
        }
        return false;
    }
1030076
private function isCurrentlyLastPage()
    {
        if ($this->page_number_type === 'start_num') {
            if ($this->page_number_value >= ($this->total_pages*$this->items_per_page)-$this->items_per_page) {
                return true;
            }
            return false;
        } elseif ($this->page_number_type === 'page_num') {
            if ($this->page_number_value >= $this->total_pages) {
                return true;
            }
            return false;
        }
        return false;
    }
696799
public function current()
    {
        return isset($this->rows[$this->rowsCounter]) ? $this->rows[$this->rowsCounter] : false;
    }
302103
public function isTimeLimitUp(float $limit = self::TIME_LIMIT): bool
    {
        $now = microtime(true);

        return $now > $this->start_time + $limit;
    }