timer: Remove in favor of sdeventplus/timer

This change removes the ad-hoc timer implementation and uses the common
one that comes with sdeventplus.

Tested: Compiled

Change-Id: Id3b7e464a472a7421785601634af58f681ebd3a6
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/power-supply/power_supply.cpp b/power-supply/power_supply.cpp
index f5187f0..ff98457 100644
--- a/power-supply/power_supply.cpp
+++ b/power-supply/power_supply.cpp
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include <functional>
 #include <phosphor-logging/log.hpp>
 #include <phosphor-logging/elog.hpp>
 #include <org/open_power/Witherspoon/Fault/error.hpp>
@@ -74,7 +75,7 @@
     : Device(name, inst), monitorPath(objpath), pmbusIntf(objpath),
       inventoryPath(INVENTORY_OBJ_PATH + invpath), bus(bus),
       presentInterval(p),
-      presentTimer(e, [this]()
+      presentTimer(e, std::bind([this]()
                    {
                        // The hwmon path may have changed.
                        pmbusIntf.findHwmonDir();
@@ -85,12 +86,12 @@
 
                        // Update the inventory for the new device
                        updateInventory();
-                   }),
+                   })),
       powerOnInterval(t),
-      powerOnTimer(e, [this]()
+      powerOnTimer(e, std::bind([this]()
                    {
                        this->powerOn = true;
-                   })
+                   }))
 {
     using namespace sdbusplus::bus;
     presentMatch = std::make_unique<match_t>(bus,
@@ -196,12 +197,12 @@
         if (sdbusplus::message::variant_ns::get<bool>(valPropMap->second))
         {
             clearFaults();
-            presentTimer.start(presentInterval, Timer::TimerType::oneshot);
+            presentTimer.restartOnce(presentInterval);
         }
         else
         {
             present = false;
-            presentTimer.stop();
+            presentTimer.setEnabled(false);
 
             //Clear out the now outdated inventory properties
             updateInventory();
@@ -238,11 +239,11 @@
         if (state)
         {
             clearFaults();
-            powerOnTimer.start(powerOnInterval, Timer::TimerType::oneshot);
+            powerOnTimer.restartOnce(powerOnInterval);
         }
         else
         {
-            powerOnTimer.stop();
+            powerOnTimer.setEnabled(false);
             powerOn = false;
         }
     }
@@ -329,7 +330,7 @@
                 powerOn = false;
                 // Start up the timer that will set the state to indicate we
                 // are ready for the powered on fault checks.
-                powerOnTimer.start(powerOnInterval, Timer::TimerType::oneshot);
+                powerOnTimer.restartOnce(powerOnInterval);
             }
         }
     }
diff --git a/power-supply/power_supply.hpp b/power-supply/power_supply.hpp
index 30f660f..a56e2e2 100644
--- a/power-supply/power_supply.hpp
+++ b/power-supply/power_supply.hpp
@@ -1,13 +1,14 @@
 #pragma once
 #include <sdbusplus/bus/match.hpp>
+#include <sdeventplus/clock.hpp>
 #include <sdeventplus/event.hpp>
+#include <sdeventplus/utility/timer.hpp>
 #include "average.hpp"
 #include "device.hpp"
 #include "maximum.hpp"
 #include "names_values.hpp"
 #include "pmbus.hpp"
 #include "record_manager.hpp"
-#include "timer.hpp"
 
 namespace witherspoon
 {
@@ -142,7 +143,7 @@
          * The timer used to do the callback after the present property has
          * changed.
          */
-        Timer presentTimer;
+        sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> presentTimer;
 
         /** @brief True if a fault has already been found and not cleared */
         bool faultFound = false;
@@ -171,7 +172,7 @@
          * The timer used to do the callback after the power state has been on
          * long enough.
          */
-        Timer powerOnTimer;
+        sdeventplus::utility::Timer<sdeventplus::ClockId::Monotonic> powerOnTimer;
 
         /** @brief Used to subscribe to D-Bus power on state changes */
         std::unique_ptr<sdbusplus::bus::match_t> powerOnMatch;