You are here

public function Simplesitemap::getGeneratedAgo in Simple XML sitemap 8.2

Returns a 'time ago' string of last timestamp generation.

Return value

string|false Formatted timestamp of last sitemap generation, otherwise FALSE.

File

src/Simplesitemap.php, line 294

Class

Simplesitemap
Class Simplesitemap @package Drupal\simple_sitemap

Namespace

Drupal\simple_sitemap

Code

public function getGeneratedAgo() {
  $chunks = $this
    ->fetchSitemapChunkInfo();
  if (isset($chunks[SitemapGenerator::FIRST_CHUNK_INDEX]->sitemap_created)) {
    return $this->dateFormatter
      ->formatInterval($this->time
      ->getRequestTime() - $chunks[SitemapGenerator::FIRST_CHUNK_INDEX]->sitemap_created);
  }
  return FALSE;
}