You are here

private function ProgressHelper::humaneTime in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Helper/ProgressHelper.php \Symfony\Component\Console\Helper\ProgressHelper::humaneTime()

Converts seconds into human-readable format.

Parameters

int $secs Number of seconds:

Return value

string Time in readable format

1 call to ProgressHelper::humaneTime()
ProgressHelper::generate in vendor/symfony/console/Helper/ProgressHelper.php
Generates the array map of format variables to values.

File

vendor/symfony/console/Helper/ProgressHelper.php, line 418

Class

ProgressHelper
The Progress class provides helpers to display progress output.

Namespace

Symfony\Component\Console\Helper

Code

private function humaneTime($secs) {
  $text = '';
  foreach ($this->timeFormats as $format) {
    if ($secs < $format[0]) {
      if (count($format) == 2) {
        $text = $format[1];
        break;
      }
      else {
        $text = ceil($secs / $format[2]) . ' ' . $format[1];
        break;
      }
    }
  }
  return $text;
}