public static function Helper::formatTime in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/console/Helper/Helper.php \Symfony\Component\Console\Helper\Helper::formatTime()
1 call to Helper::formatTime()
- ProgressBar::initPlaceholderFormatters in vendor/
symfony/ console/ Helper/ ProgressBar.php
File
- vendor/
symfony/ console/ Helper/ Helper.php, line 65
Class
- Helper
- Helper is the base class for all helper classes.
Namespace
Symfony\Component\Console\HelperCode
public static function formatTime($secs) {
static $timeFormats = array(
array(
0,
'< 1 sec',
),
array(
2,
'1 sec',
),
array(
59,
'secs',
1,
),
array(
60,
'1 min',
),
array(
3600,
'mins',
60,
),
array(
5400,
'1 hr',
),
array(
86400,
'hrs',
3600,
),
array(
129600,
'1 day',
),
array(
604800,
'days',
86400,
),
);
foreach ($timeFormats as $format) {
if ($secs >= $format[0]) {
continue;
}
if (2 == count($format)) {
return $format[1];
}
return ceil($secs / $format[2]) . ' ' . $format[1];
}
}