Fix setting remaining time lower than minInterval
When a minimum interval is specified, setting the remaining time should
also honor the setting and keep the initial remaining time (initial
countdown in IPMI terms) at a mimimal interval values.
Tested: see next patch for unit tests
Resolves: openbmc/phosphor-watchdog#1
Signed-off-by: Kun Yi <kunyi731@gmail.com>
Change-Id: I1f5d244bb7b0985227344a3634e3b7c4da2624fc
diff --git a/watchdog.cpp b/watchdog.cpp
index 9090760..57e9050 100644
--- a/watchdog.cpp
+++ b/watchdog.cpp
@@ -79,7 +79,12 @@
return 0;
}
- if (!this->enabled())
+ if (this->enabled())
+ {
+ // Update interval to minInterval if applicable
+ value = std::max(value, minInterval);
+ }
+ else
{
// Having a timer but not displaying an enabled value means we
// are inside of the fallback