Unsigned Integer DCI and diff()
-
I've been monitoring UPS runtime, and as that really should never go into a negative value, I thought I'd use an unsigned integer for the DCI.
I also used a threshold to alert if the runtime dropped by 20 minutes within 1 minute, kind of as an indicator that the battery is on its way out.The result of the above setup is that the threshold gets triggered a lot. Every time the runtime goes down, it triggers.
For all I can tell this is due to the unsigned integer. If the the difference to the previous value is negative (i.e. from 120 to 116, a difference of -4), it compares the threshold of 20 with 4294967292 (i.e. 2^32 - diff). I don't think the unsigned integer class for the actual value should apply to the result of the diff?
Or did is this some other odd issue I ran into? Since switching from Unsigned Int to Integer, I'm not getting these alerts anymore. -
Hi,
it's actually a bug, diff definitely should be treated as signed value. I'll register it in our issue tracker.
Best regards,
Victor -
Fixed in version 2.1-M2.
Best regards,
Victor
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login