summaryrefslogtreecommitdiffstats
path: root/softoff/timer.hpp
diff options
context:
space:
mode:
authorVishwanatha Subbanna <vishwa@linux.vnet.ibm.com>2017-02-01 18:02:38 +0530
committerPatrick Williams <patrick@stwcx.xyz>2017-03-27 13:27:01 -0500
commitd27e71e23cbe02dad145419c46c064d212420836 (patch)
treecc8743ab9bc4f69b0d0a7908e7a74c2a06feb351 /softoff/timer.hpp
parent072482986dfa60a905392c2dc49031ad7296bf2a (diff)
downloadphosphor-host-ipmid-d27e71e23cbe02dad145419c46c064d212420836.tar.gz
phosphor-host-ipmid-d27e71e23cbe02dad145419c46c064d212420836.zip
Add routines to start and stop the sd_event timer
Change-Id: I738be7b70554125e544aa59fe1770e909d3dffb1 Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
Diffstat (limited to 'softoff/timer.hpp')
-rw-r--r--softoff/timer.hpp13
1 files changed, 12 insertions, 1 deletions
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 @@ class Timer
}
}
- 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 @@ class Timer
*/
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
OpenPOWER on IntegriCloud