Changed the host time to bmc time
Since we removed the TimeOwner feature, should be used bmc time when
calling the get/setSelTime method.
Refer: https://lists.ozlabs.org/pipermail/openbmc/2020-April/021409.html
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Icba466ec1f987f4f080f2f16a5381ec5105d050f
diff --git a/storagehandler.cpp b/storagehandler.cpp
index e4b43dd..74e5d65 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -40,7 +40,7 @@
namespace
{
constexpr auto TIME_INTERFACE = "xyz.openbmc_project.Time.EpochTime";
-constexpr auto HOST_TIME_PATH = "/xyz/openbmc_project/time/host";
+constexpr auto BMC_TIME_PATH = "/xyz/openbmc_project/time/bmc";
constexpr auto DBUS_PROPERTIES = "org.freedesktop.DBus.Properties";
constexpr auto PROPERTY_ELAPSED = "Elapsed";
@@ -478,17 +478,17 @@
ipmiStorageGetSelTime()
{
using namespace std::chrono;
- uint64_t host_time_usec = 0;
- std::stringstream hostTime;
+ uint64_t bmc_time_usec = 0;
+ std::stringstream bmcTime;
try
{
sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
- auto service = ipmi::getService(bus, TIME_INTERFACE, HOST_TIME_PATH);
+ auto service = ipmi::getService(bus, TIME_INTERFACE, BMC_TIME_PATH);
std::variant<uint64_t> value;
- // Get host time
- auto method = bus.new_method_call(service.c_str(), HOST_TIME_PATH,
+ // Get bmc time
+ auto method = bus.new_method_call(service.c_str(), BMC_TIME_PATH,
DBUS_PROPERTIES, "Get");
method.append(TIME_INTERFACE, PROPERTY_ELAPSED);
@@ -497,11 +497,11 @@
{
log<level::ERR>("Error getting time",
entry("SERVICE=%s", service.c_str()),
- entry("PATH=%s", HOST_TIME_PATH));
+ entry("PATH=%s", BMC_TIME_PATH));
return ipmi::responseUnspecifiedError();
}
reply.read(value);
- host_time_usec = std::get<uint64_t>(value);
+ bmc_time_usec = std::get<uint64_t>(value);
}
catch (InternalFailure& e)
{
@@ -514,15 +514,15 @@
return ipmi::responseUnspecifiedError();
}
- hostTime << "Host time:"
- << duration_cast<seconds>(microseconds(host_time_usec)).count();
- log<level::DEBUG>(hostTime.str().c_str());
+ bmcTime << "BMC time:"
+ << duration_cast<seconds>(microseconds(bmc_time_usec)).count();
+ log<level::DEBUG>(bmcTime.str().c_str());
// Time is really long int but IPMI wants just uint32. This works okay until
// the number of seconds since 1970 overflows uint32 size.. Still a whole
// lot of time here to even think about that.
return ipmi::responseSuccess(
- duration_cast<seconds>(microseconds(host_time_usec)).count());
+ duration_cast<seconds>(microseconds(bmc_time_usec)).count());
}
/** @brief implements the set SEL time command
@@ -538,11 +538,11 @@
try
{
sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
- auto service = ipmi::getService(bus, TIME_INTERFACE, HOST_TIME_PATH);
+ auto service = ipmi::getService(bus, TIME_INTERFACE, BMC_TIME_PATH);
std::variant<uint64_t> value{(uint64_t)usec.count()};
- // Set host time
- auto method = bus.new_method_call(service.c_str(), HOST_TIME_PATH,
+ // Set bmc time
+ auto method = bus.new_method_call(service.c_str(), BMC_TIME_PATH,
DBUS_PROPERTIES, "Set");
method.append(TIME_INTERFACE, PROPERTY_ELAPSED, value);
@@ -551,7 +551,7 @@
{
log<level::ERR>("Error setting time",
entry("SERVICE=%s", service.c_str()),
- entry("PATH=%s", HOST_TIME_PATH));
+ entry("PATH=%s", BMC_TIME_PATH));
return ipmi::responseUnspecifiedError();
}
}