Add routines to start and stop the sd_event timer
Change-Id: I738be7b70554125e544aa59fe1770e909d3dffb1
Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
diff --git a/softoff/timer.hpp b/softoff/timer.hpp
index 7c3bac2..9d597f8 100644
--- a/softoff/timer.hpp
+++ b/softoff/timer.hpp
@@ -38,11 +38,19 @@
}
}
- inline auto isExpired()
+ inline auto isExpired() const
{
return expired;
}
+ /** @brief Starts the timer with specified expiration value.
+ * input is an offset from the current steady_clock
+ */
+ int startTimer(std::chrono::microseconds usec);
+
+ /** @brief Enables / disables the timer */
+ int setTimer(int action);
+
private:
/** @brief the sd_event structure */
sd_event* timeEvent = nullptr;
@@ -76,6 +84,9 @@
*/
static int timeoutHandler(sd_event_source* eventSource,
uint64_t usec, void* userData);
+
+ /** @brief Gets the current time from steady clock */
+ static std::chrono::microseconds getTime();
};
} // namespace ipmi