sensor-mon: Persist timer start times
It's possible that while a shutdown timer is running, this app or the
whole BMC may restart. In that case, we want to restart the timer with
only the remaining time, assuming the alarm is still active.
To do this, create a new AlarmTimestamps class to hold any running timer
start times and persist these times using the cereal library. If the
application is restarted with timestamps written out and the alarm is
initially active and power is on, then the shutdown timer will be
calculated to be:
delay = shutdownDelay - (now - original time)
Note that cereal doesn't know how to handle the AlarmType or
ShutdownType types so they are converted to ints before writing.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: If07abe91c0e6951fcd74bbc49eb511a38f7b4006
diff --git a/configure.ac b/configure.ac
index ae01878..c31f09b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -233,6 +233,14 @@
AS_IF([test "x$enable_sensor_monitor" == "xyes"], [
+ AC_ARG_VAR(SENSOR_MONITOR_PERSIST_ROOT_PATH,
+ [Root path for persisting sensor monitor data])
+ AS_IF([test "x$SENSOR_MONITOR_PERSIST_ROOT_PATH" == "x"],
+ [SENSOR_MONITOR_PERSIST_ROOT_PATH="/var/lib/phosphor-fan-presence/sensor-monitor"])
+ AC_DEFINE_UNQUOTED([SENSOR_MONITOR_PERSIST_ROOT_PATH],
+ ["$SENSOR_MONITOR_PERSIST_ROOT_PATH"],
+ [Root path for persisting sensor monitor data])
+
#Default hard shutdown delay is 23 seconds
AC_ARG_VAR(SHUTDOWN_ALARM_HARD_SHUTDOWN_DELAY_MS,
[Milliseconds to delay the alarm hard shutdown])