pldm: Fix calling getProperty method in GetDateTime method
An error in calling the getProperty method in the GetDateTime method
resulted in GetDateTime always returns epoch time 0.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Iecdbbc489c298a2544d72599110116b7f4373857
diff --git a/libpldmresponder/bios.cpp b/libpldmresponder/bios.cpp
index 13b36ab..2d3a8ee 100644
--- a/libpldmresponder/bios.cpp
+++ b/libpldmresponder/bios.cpp
@@ -145,13 +145,12 @@
constexpr auto hostTimePath = "/xyz/openbmc_project/time/host";
Response response(sizeof(pldm_msg_hdr) + PLDM_GET_DATE_TIME_RESP_BYTES, 0);
auto responsePtr = reinterpret_cast<pldm_msg*>(response.data());
- std::variant<EpochTimeUS> value;
+ EpochTimeUS timeUsec;
try
{
- value = pldm::utils::DBusHandler()
- .getDbusProperty<std::variant<EpochTimeUS>>(
- hostTimePath, "Elapsed", timeInterface);
+ timeUsec = pldm::utils::DBusHandler().getDbusProperty<EpochTimeUS>(
+ hostTimePath, "Elapsed", timeInterface);
}
catch (const sdbusplus::exception::SdBusError& e)
{
@@ -164,8 +163,6 @@
return response;
}
- uint64_t timeUsec = std::get<EpochTimeUS>(value);
-
uint64_t timeSec = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::microseconds(timeUsec))
.count();