Unify time interval formatting (#14733)

* Unify time interval formatting
Use carbon for formatting, it supports locales.

* fix style

* remove baseline exceptions

* fixes found by lint
This commit is contained in:
Tony Murray
2022-12-15 15:52:53 -06:00
committed by GitHub
parent d091788f28
commit 1d3440b943
10 changed files with 39 additions and 155 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Observers;
use App\Models\Eventlog;
use App\Models\Stp;
use LibreNMS\Util\Time;
class StpObserver
{
@@ -24,7 +25,7 @@ class StpObserver
}
if ($stp->isDirty('rootPort')) {
$time = \LibreNMS\Util\Time::formatInterval($stp->timeSinceTopologyChange);
$time = Time::formatInterval((int) $stp->timeSinceTopologyChange);
Eventlog::log('STP topology changed after: ' . $time, $stp->device_id, 'stp', 4);
}
}