mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Use Number::constrainInteger instead of unsignedToSigned in Cisco NTP poller (#15667)
* switch to constrainInteger for cisco ntp too * correct styleci issue
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
* the source code distribution for details.
|
||||
*/
|
||||
|
||||
use LibreNMS\Enum\IntegerType;
|
||||
use LibreNMS\RRD\RrdDefinition;
|
||||
use LibreNMS\Util\Number;
|
||||
|
||||
@@ -63,10 +64,10 @@ if (is_array($components) && count($components) > 0) {
|
||||
// the last 16 bits.
|
||||
|
||||
$hexoffset = $cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][23][$array['UID']];
|
||||
$rrd['offset'] = Number::unsignedAsSigned(hexdec(substr($hexoffset, 0, 5)), 16) + hexdec(substr($hexoffset, -5)) / 65536;
|
||||
$rrd['offset'] = Number::constrainInteger(hexdec(substr($hexoffset, 0, 5)), IntegerType::int16) + hexdec(substr($hexoffset, -5)) / 65536;
|
||||
|
||||
$hexdelay = $cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][24][$array['UID']];
|
||||
$rrd['delay'] = Number::unsignedAsSigned(hexdec(substr($hexdelay, 0, 5)), 16) + hexdec(substr($hexdelay, -5)) / 65536;
|
||||
$rrd['delay'] = Number::constrainInteger(hexdec(substr($hexdelay, 0, 5)), IntegerType::int16) + hexdec(substr($hexdelay, -5)) / 65536;
|
||||
|
||||
// Cisco NTPUnsignedTimeValue - 16 bits of unsignedint, and 16 bits of unsignedint for fractional
|
||||
$hexdisp = $cntpPeersVarEntry['1.3.6.1.4.1.9.9.168.1.2.1.1'][25][$array['UID']];
|
||||
|
Reference in New Issue
Block a user