|
@@ -64,5 +64,18 @@ bool Timer<T>::expired(T msPeriod)
|
|
|
return expired;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * @brief Ticks since the timer was started
|
|
|
+ *
|
|
|
+ * This function returns 0 if the timer is not started. Otherwise, it returns
|
|
|
+ * the time in milliseconds since the timer was started.
|
|
|
+ * This function is expected to handle wrap around of time register well.
|
|
|
+ * The maximum elapsed time is dictated by the template type
|
|
|
+ */
|
|
|
+template<typename T>
|
|
|
+T Timer<T>::elapsed() {
|
|
|
+ return m_isRunning ? (_millis() - m_started) : 0;
|
|
|
+}
|
|
|
+
|
|
|
template class Timer<unsigned long>;
|
|
|
template class Timer<unsigned short>;
|