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>
diff --git a/control/zone.cpp b/control/zone.cpp
index 4531151..293945c 100644
--- a/control/zone.cpp
+++ b/control/zone.cpp
@@ -18,6 +18,7 @@
 #include <phosphor-logging/log.hpp>
 #include <phosphor-logging/elog.hpp>
 #include <phosphor-logging/elog-errors.hpp>
+#include <stdexcept>
 #include <xyz/openbmc_project/Common/error.hpp>
 #include "zone.hpp"
 #include "utility.hpp"
@@ -72,10 +73,7 @@
             initEvent(event);
         }
         // Start timer for fan speed decreases
-        if (!_decTimer.running() && _decInterval != seconds::zero())
-        {
-            _decTimer.start(_decInterval, TimerType::repeating);
-        }
+        _decTimer.restart(_decInterval);
     }
 }
 
@@ -238,14 +236,9 @@
         {
             requestTarget = _ceilingSpeed;
         }
-        // Cancel current timer countdown
-        if (_incTimer.running())
-        {
-            _incTimer.stop();
-        }
         setSpeed(requestTarget);
-        // Start timer countdown for fan speed increase
-        _incTimer.start(_incDelay, TimerType::oneshot);
+        // Retart timer countdown for fan speed increase
+        _incTimer.restartOnce(_incDelay);
     }
 }
 
@@ -277,7 +270,7 @@
     // where no requested increases exist and
     // the increase timer is not running
     // (i.e. not in the middle of increasing)
-    if (decAllowed && _incSpeedDelta == 0 && !_incTimer.running())
+    if (decAllowed && _incSpeedDelta == 0 && !_incTimer.isEnabled())
     {
         auto requestTarget = getRequestSpeedBase();
         // Request target speed should not start above ceiling
@@ -449,26 +442,31 @@
                     const std::vector<Action>& actions,
                     const TimerConf& tConf)
 {
-    // Associate event data with timer
-    auto data = std::make_unique<EventData>(
+    auto eventData = std::make_unique<EventData>(
             group,
             "",
             nullptr,
             actions
     );
-    auto timer = std::make_unique<util::Timer>(
+    Timer timer(
         _eventLoop,
         std::bind(&Zone::timerExpired,
                   this,
-                  std::cref(std::get<Group>(*data)),
-                  std::cref(std::get<std::vector<Action>>(*data)))
-    );
-    if (!timer->running())
+                  std::cref(std::get<Group>(*eventData)),
+                  std::cref(std::get<std::vector<Action>>(*eventData))));
+    if (std::get<TimerType>(tConf) == TimerType::repeating)
     {
-        timer->start(std::get<intervalPos>(tConf),
-                     std::get<typePos>(tConf));
+        timer.restart(std::get<intervalPos>(tConf));
     }
-    _timerEvents.emplace_back(std::move(data), std::move(timer));
+    else if (std::get<TimerType>(tConf) == TimerType::oneshot)
+    {
+        timer.restartOnce(std::get<intervalPos>(tConf));
+    }
+    else
+    {
+        throw std::invalid_argument("Invalid Timer Type");
+    }
+    _timerEvents.emplace_back(std::move(eventData), std::move(timer));
 }
 
 void Zone::timerExpired(const Group& eventGroup,