Move to steady_timer

deadline_timer and steady_timer have one important difference, the
former runs off CLOCK_REALTIME, and the later runs off CLOCK_MONOTONIC.
For a long time we've relied on deadline_timer incorrectly, given that
dbus-sensors does not care in the least about the calendar time, and
only cares about the difference between sensor scans.

Fortunately, this likely has no effect on the behavior of the sensors
most of the time, and in general, in a time change, the clock generally
moves forward, so all timers would immediately expire, scan all sensors,
and move on.  phosphor-pid-control is intentionally designed to handle
this case, so it's quite likely that a user would never notice it, and
even if they did, would have to be looking at a debug console the moment
it happened.

The other effect is that in most cases, sensors call clock_gettime more
than they probably need to, which might slow down the performance.

This commit moves all usages of sensor timing to steady_timer, which
should give us more consistent results, and (in theory at least) be
faster.  Because of stdlib compliance things, this also has the effect
of us dropping our dependence on boost::posix_time, and move to
std::chrono::duration objects, per the coding standard.

Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I69f948fb3f0fc0dfd7fd196d26ba46742a3e15a7
diff --git a/include/ADCSensor.hpp b/include/ADCSensor.hpp
index 79c220a..5c4b8ed 100644
--- a/include/ADCSensor.hpp
+++ b/include/ADCSensor.hpp
@@ -79,7 +79,7 @@
   private:
     sdbusplus::asio::object_server& objServer;
     boost::asio::posix::stream_descriptor inputDev;
-    boost::asio::deadline_timer waitTimer;
+    boost::asio::steady_timer waitTimer;
     std::shared_ptr<boost::asio::streambuf> readBuf;
     std::string path;
     double scaleFactor;
diff --git a/include/ChassisIntrusionSensor.hpp b/include/ChassisIntrusionSensor.hpp
index 56affca..8954033 100644
--- a/include/ChassisIntrusionSensor.hpp
+++ b/include/ChassisIntrusionSensor.hpp
@@ -1,7 +1,7 @@
 #pragma once
 
-#include <boost/asio/deadline_timer.hpp>
 #include <boost/asio/io_service.hpp>
+#include <boost/asio/steady_timer.hpp>
 #include <gpiod.hpp>
 #include <sdbusplus/asio/object_server.hpp>
 
@@ -39,7 +39,7 @@
     // valid if it is PCH register via i2c
     int mBusId{-1};
     int mSlaveAddr{-1};
-    boost::asio::deadline_timer mPollTimer;
+    boost::asio::steady_timer mPollTimer;
 
     // valid if it is via GPIO
     bool mGpioInverted{false};
diff --git a/include/HwmonTempSensor.hpp b/include/HwmonTempSensor.hpp
index 640875b..af275ec 100644
--- a/include/HwmonTempSensor.hpp
+++ b/include/HwmonTempSensor.hpp
@@ -40,7 +40,7 @@
     std::array<char, 128> readBuf{};
     sdbusplus::asio::object_server& objServer;
     boost::asio::random_access_file inputDev;
-    boost::asio::deadline_timer waitTimer;
+    boost::asio::steady_timer waitTimer;
     std::string path;
     double offsetValue;
     double scaleValue;
diff --git a/include/IntelCPUSensor.hpp b/include/IntelCPUSensor.hpp
index 844c861..5f9124e 100644
--- a/include/IntelCPUSensor.hpp
+++ b/include/IntelCPUSensor.hpp
@@ -39,7 +39,7 @@
     sdbusplus::asio::object_server& objServer;
     boost::asio::streambuf readBuf;
     boost::asio::posix::stream_descriptor inputDev;
-    boost::asio::deadline_timer waitTimer;
+    boost::asio::steady_timer waitTimer;
     std::string nameTcontrol;
     std::string path;
     double privTcontrol;
diff --git a/include/IpmbSensor.hpp b/include/IpmbSensor.hpp
index 93c06fb..f142a5a 100644
--- a/include/IpmbSensor.hpp
+++ b/include/IpmbSensor.hpp
@@ -1,5 +1,5 @@
 #pragma once
-#include <boost/asio/deadline_timer.hpp>
+#include <boost/asio/steady_timer.hpp>
 #include <boost/container/flat_map.hpp>
 #include <sensor.hpp>
 
@@ -116,5 +116,5 @@
 
   private:
     sdbusplus::asio::object_server& objectServer;
-    boost::asio::deadline_timer waitTimer;
+    boost::asio::steady_timer waitTimer;
 };
diff --git a/include/MCUTempSensor.hpp b/include/MCUTempSensor.hpp
index e0474f1..c4c2406 100644
--- a/include/MCUTempSensor.hpp
+++ b/include/MCUTempSensor.hpp
@@ -1,5 +1,5 @@
 #pragma once
-#include <boost/asio/deadline_timer.hpp>
+#include <boost/asio/steady_timer.hpp>
 #include <boost/container/flat_map.hpp>
 #include <sensor.hpp>
 
@@ -30,5 +30,5 @@
   private:
     int getMCURegsInfoWord(uint8_t regs, int16_t* pu16data) const;
     sdbusplus::asio::object_server& objectServer;
-    boost::asio::deadline_timer waitTimer;
+    boost::asio::steady_timer waitTimer;
 };
diff --git a/include/NVMeContext.hpp b/include/NVMeContext.hpp
index 230ca74..5be03e0 100644
--- a/include/NVMeContext.hpp
+++ b/include/NVMeContext.hpp
@@ -2,8 +2,8 @@
 
 #include "NVMeSensor.hpp"
 
-#include <boost/asio/deadline_timer.hpp>
 #include <boost/asio/io_service.hpp>
+#include <boost/asio/steady_timer.hpp>
 
 #include <memory>
 #include <stdexcept>
@@ -98,7 +98,7 @@
                                  size_t len) = 0;
 
   protected:
-    boost::asio::deadline_timer scanTimer;
+    boost::asio::steady_timer scanTimer;
     int rootBus; // Root bus for this drive
     std::list<std::shared_ptr<NVMeSensor>> sensors;
     std::list<std::shared_ptr<NVMeSensor>>::iterator pollCursor;
diff --git a/include/PSUEvent.hpp b/include/PSUEvent.hpp
index 824019c..25a7ebc 100644
--- a/include/PSUEvent.hpp
+++ b/include/PSUEvent.hpp
@@ -17,9 +17,9 @@
 #pragma once
 
 #include <Utils.hpp>
-#include <boost/asio/deadline_timer.hpp>
 #include <boost/asio/io_service.hpp>
 #include <boost/asio/random_access_file.hpp>
+#include <boost/asio/steady_timer.hpp>
 #include <boost/container/flat_map.hpp>
 #include <sdbusplus/asio/object_server.hpp>
 
@@ -56,7 +56,7 @@
     std::string eventName;
 
     PowerState readState;
-    boost::asio::deadline_timer waitTimer;
+    boost::asio::steady_timer waitTimer;
     std::shared_ptr<std::array<char, 128>> buffer;
     void restartRead();
     void handleResponse(const boost::system::error_code& err,
diff --git a/include/PSUSensor.hpp b/include/PSUSensor.hpp
index 6466179..63699ea 100644
--- a/include/PSUSensor.hpp
+++ b/include/PSUSensor.hpp
@@ -33,7 +33,7 @@
     std::shared_ptr<std::array<char, 128>> buffer;
     sdbusplus::asio::object_server& objServer;
     boost::asio::random_access_file inputDev;
-    boost::asio::deadline_timer waitTimer;
+    boost::asio::steady_timer waitTimer;
     std::string path;
     unsigned int sensorFactor;
     double sensorOffset;
diff --git a/include/TachSensor.hpp b/include/TachSensor.hpp
index a9da29f..c360395 100644
--- a/include/TachSensor.hpp
+++ b/include/TachSensor.hpp
@@ -87,7 +87,7 @@
     std::shared_ptr<sdbusplus::asio::dbus_interface> itemIface;
     std::shared_ptr<sdbusplus::asio::dbus_interface> itemAssoc;
     boost::asio::random_access_file inputDev;
-    boost::asio::deadline_timer waitTimer;
+    boost::asio::steady_timer waitTimer;
     std::string path;
     std::optional<std::string> led;
     bool ledState = false;
diff --git a/include/Thresholds.hpp b/include/Thresholds.hpp
index ae1f528..0b17c62 100644
--- a/include/Thresholds.hpp
+++ b/include/Thresholds.hpp
@@ -1,7 +1,7 @@
 #pragma once
 #include <Utils.hpp>
-#include <boost/asio/deadline_timer.hpp>
 #include <boost/asio/io_service.hpp>
+#include <boost/asio/steady_timer.hpp>
 #include <nlohmann/json.hpp>
 
 #include <list>
@@ -62,7 +62,7 @@
     bool assert;
 };
 
-using TimerPair = std::pair<struct TimerUsed, boost::asio::deadline_timer>;
+using TimerPair = std::pair<struct TimerUsed, boost::asio::steady_timer>;
 
 struct ThresholdTimer
 {