You are here

public function LogEntry::formatDuration in Ultimate Cron 8.2

Format duration.

File

src/Logger/LogEntry.php, line 154

Class

LogEntry
Class for Ultimate Cron log entries.

Namespace

Drupal\ultimate_cron\Logger

Code

public function formatDuration() {
  $duration = $this
    ->getDuration();
  switch (TRUE) {
    case $duration >= 86400:
      $format = 'd H:i:s';
      break;
    case $duration >= 3600:
      $format = 'H:i:s';
      break;
    default:
      $format = 'i:s';
  }
  return isset($duration) ? gmdate($format, $duration) : t('N/A');
}