Migrate to a common timer class
This change pulls in sdeventplus and uses the timer implementation as
a drop in for the currently included timer.
Tested:
Unit tests still build but are not currently running. Manually
tested this change on a zaius machine and made sure timers went off.
Change-Id: I2808196581fc766843931403b83fead16926b0ae
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/network_manager.cpp b/network_manager.cpp
index c1b0ba6..35a9fc8 100644
--- a/network_manager.cpp
+++ b/network_manager.cpp
@@ -4,7 +4,7 @@
#include "ipaddress.hpp"
#include "network_config.hpp"
-#include "timer.hpp"
+#include "types.hpp"
#include "util.hpp"
#include <arpa/inet.h>
@@ -25,8 +25,8 @@
namespace network
{
-extern std::unique_ptr<phosphor::network::Timer> refreshObjectTimer;
-extern std::unique_ptr<phosphor::network::Timer> restartTimer;
+extern std::unique_ptr<Timer> refreshObjectTimer;
+extern std::unique_ptr<Timer> restartTimer;
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
@@ -207,15 +207,8 @@
using namespace std::chrono;
if (refreshObjectTimer && restartTimer)
{
- // start the restart timer.
- auto restartTime =
- duration_cast<microseconds>(phosphor::network::restartTimeout);
- restartTimer->startTimer(restartTime);
-
- // start the refresh timer.
- auto refreshTime =
- duration_cast<microseconds>(phosphor::network::refreshTimeout);
- refreshObjectTimer->startTimer(refreshTime);
+ restartTimer->restartOnce(restartTimeout);
+ refreshObjectTimer->restartOnce(refreshTimeout);
}
}