mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 08:44:10 +02:00
Merge pull request #3667 from Icinga/bugfix/undefined-offset-100-3589
Format::seconds(): handle negative values as expected (cherry picked from commit 57f54b0f76708f0bb7894b8f4f2583db9872ca8f) Signed-off-by: Johannes Meyer <johannes.meyer@icinga.com>
This commit is contained in:
parent
d067bf2a1c
commit
9b93899068
@ -54,11 +54,13 @@ class Format
|
||||
|
||||
public static function seconds($value)
|
||||
{
|
||||
if ($value < 60) {
|
||||
$absValue = abs($value);
|
||||
|
||||
if ($absValue < 60) {
|
||||
return self::formatForUnits($value, self::$secondPrefix, self::$secondBase);
|
||||
} elseif ($value < 3600) {
|
||||
} elseif ($absValue < 3600) {
|
||||
return sprintf('%0.2f m', $value / 60);
|
||||
} elseif ($value < 86400) {
|
||||
} elseif ($absValue < 86400) {
|
||||
return sprintf('%0.2f h', $value / 3600);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user