Use time mode owner enums in dbus interface
Dbus interface defines time mode owners in xyz::openbmc_project::Time.
Use the enums from the interface instead of repo defined enums and use
the generated code to do convertions between strings and enums.
Update unit tests accordingly.
Change-Id: Ic304aa3b4137375d208bb1702e0f64df512fc5a0
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/host_epoch.cpp b/host_epoch.cpp
index 129d224..99cdf6d 100644
--- a/host_epoch.cpp
+++ b/host_epoch.cpp
@@ -25,7 +25,7 @@
uint64_t HostEpoch::elapsed() const
{
auto ret = getTime();
- if (timeOwner == Owner::SPLIT)
+ if (timeOwner == Owner::Split)
{
ret += offset;
}
@@ -48,7 +48,7 @@
*/
if (timeOwner == Owner::BMC ||
(timeMode == Mode::NTP
- && (timeOwner == Owner::HOST || timeOwner == Owner::BOTH)))
+ && (timeOwner == Owner::Host || timeOwner == Owner::Both)))
{
log<level::ERR>("Setting HostTime is not allowed");
// TODO: throw NotAllowed exception
@@ -56,7 +56,7 @@
}
auto time = microseconds(value);
- if (timeOwner == Owner::SPLIT)
+ if (timeOwner == Owner::Split)
{
// Calculate the offset between host and bmc time
offset = time - getTime();
@@ -82,7 +82,7 @@
// If timeOwner is changed to SPLIT, the offset shall be preserved
// Otherwise it shall be cleared;
timeOwner = owner;
- if (timeOwner != Owner::SPLIT)
+ if (timeOwner != Owner::Split)
{
offset = microseconds(0);
saveOffset();
@@ -99,7 +99,7 @@
{
// If owner is split and BMC time is changed,
// the offset shall be adjusted
- if (timeOwner == Owner::SPLIT)
+ if (timeOwner == Owner::Split)
{
auto steadyTime = duration_cast<microseconds>(
steady_clock::now().time_since_epoch());