diff options
author | William A. Kennington III <wak@google.com> | 2018-10-30 19:49:29 -0700 |
---|---|---|
committer | Matthew Barth <msbarth@linux.ibm.com> | 2019-02-05 16:20:02 +0000 |
commit | 8fd879fb7bb9ed34fe69581dc714b4158046519f (patch) | |
tree | aa33e860d7d018fd9670599039e459a4bebc6324 /monitor | |
parent | a1aef7a100a9b27d2133622a695bb8c09c2869bf (diff) | |
download | phosphor-fan-presence-8fd879fb7bb9ed34fe69581dc714b4158046519f.tar.gz phosphor-fan-presence-8fd879fb7bb9ed34fe69581dc714b4158046519f.zip |
Remove timer in favor of sdeventplus/utility/timer
This removes the custom timer implementation and moves to the
sdeventplus utility. Functionally this should make no change
Tested:
Built and run through the unit test suite.
Change-Id: Ib7ee90d489d5db72496aaaca91c3cf5490ad47d6
Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'monitor')
-rw-r--r-- | monitor/tach_sensor.cpp | 17 | ||||
-rw-r--r-- | monitor/tach_sensor.hpp | 9 |
2 files changed, 7 insertions, 19 deletions
diff --git a/monitor/tach_sensor.cpp b/monitor/tach_sensor.cpp index 26ba3c9..5494450 100644 --- a/monitor/tach_sensor.cpp +++ b/monitor/tach_sensor.cpp @@ -221,24 +221,11 @@ void TachSensor::handleTachChange(sdbusplus::message::message& msg) void TachSensor::startTimer(TimerMode mode) { - if (!timerRunning()) + if (!timerRunning() || mode != _timerMode) { - _timer.start( - getDelay(mode), - util::Timer::TimerType::oneshot); + _timer.restartOnce(getDelay(mode)); _timerMode = mode; } - else - { - if (mode != _timerMode) - { - _timer.stop(); - _timer.start( - getDelay(mode), - util::Timer::TimerType::oneshot); - _timerMode = mode; - } - } } std::chrono::microseconds TachSensor::getDelay(TimerMode mode) diff --git a/monitor/tach_sensor.hpp b/monitor/tach_sensor.hpp index c46aa00..2a643c5 100644 --- a/monitor/tach_sensor.hpp +++ b/monitor/tach_sensor.hpp @@ -3,8 +3,9 @@ #include <chrono> #include <sdbusplus/bus.hpp> #include <sdbusplus/server.hpp> +#include <sdeventplus/clock.hpp> #include <sdeventplus/event.hpp> -#include "timer.hpp" +#include <sdeventplus/utility/timer.hpp> namespace phosphor { @@ -158,7 +159,7 @@ class TachSensor */ inline bool timerRunning() { - return _timer.running(); + return _timer.isEnabled(); } /** @@ -174,7 +175,7 @@ class TachSensor */ inline void stopTimer() { - _timer.stop(); + _timer.setEnabled(false); } /** @@ -302,7 +303,7 @@ class TachSensor /** * The timer object */ - phosphor::fan::util::Timer _timer; + sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> _timer; /** * @brief The match object for the Value properties changed signal |