Implement HostEpoch set time logic
1. When setting host epoch, follow below logic:
Mode | Owner | Set Host Time
----- | ----- | -------------
NTP | BMC | Not allowed
NTP | HOST | Not allowed
NTP | SPLIT | OK, and just save offset
NTP | BOTH | Not allowed
MANUAL| BMC | Not allowed
MANUAL| HOST | OK, and set time to BMC
MANUAL| SPLIT | OK, and just save offset
MANUAL| BOTH | OK, and set time to BMC
2. If owner is SPLIT and BMC time is changed, update the offset accordinly;
3. Use timerfd to get notified on BMC time change, and update host time
diff accordingly;
4. Add unit test cases.
Change-Id: I2d60a821f7da9b689c579ae7ab672cc37967322c
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/bmc_time_change_listener.hpp b/bmc_time_change_listener.hpp
new file mode 100644
index 0000000..44fc479
--- /dev/null
+++ b/bmc_time_change_listener.hpp
@@ -0,0 +1,24 @@
+#pragma once
+
+#include <chrono>
+
+namespace phosphor
+{
+namespace time
+{
+
+class BmcTimeChangeListener
+{
+ public:
+ virtual ~BmcTimeChangeListener() = default;
+
+ /** @brief Notified on bmc time is changed
+ *
+ * @param[in] bmcTime - The epoch time in microseconds
+ */
+ virtual void onBmcTimeChanged(
+ const std::chrono::microseconds& bmcTime) = 0;
+};
+
+}
+}