Fix the invalid value of Elapsed property
The Elapsed property is described in microseconds in the interface but the result value is in seconds before
Tested:
1. get the property by this: busctl introspect xyz.openbmc_project.Dump.Manager /xyz/openbmc_project/dump/bm:c/entry/20 xyz.openbmc_project.Time.EpochTime
2. check the value
NAME TYPE SIGNATURE RESULT/VALUE FLAGS
.Elapsed property t 1645758497000000 emits-change writable
Change-Id: Ib6cd5261c4cd6ac7de239f291a9f5fb556b29e89
Signed-off-by: Xie Ning <xiening.xll@bytedance.com>
diff --git a/dump_manager_bmc.cpp b/dump_manager_bmc.cpp
index 156ea9f..26adf67 100644
--- a/dump_manager_bmc.cpp
+++ b/dump_manager_bmc.cpp
@@ -148,7 +148,7 @@
}
auto idString = match[ID_POS];
- auto msString = match[EPOCHTIME_POS];
+ uint64_t timestamp = stoull(match[EPOCHTIME_POS]) * 1000 * 1000;
auto id = stoul(idString);
@@ -157,7 +157,7 @@
if (dumpEntry != entries.end())
{
dynamic_cast<phosphor::dump::bmc::Entry*>(dumpEntry->second.get())
- ->update(stoull(msString), std::filesystem::file_size(file), file);
+ ->update(timestamp, std::filesystem::file_size(file), file);
return;
}
@@ -168,7 +168,7 @@
{
entries.insert(std::make_pair(
id, std::make_unique<bmc::Entry>(
- bus, objPath.c_str(), id, stoull(msString),
+ bus, objPath.c_str(), id, timestamp,
std::filesystem::file_size(file), file,
phosphor::dump::OperationStatus::Completed, *this)));
}
@@ -178,7 +178,7 @@
fmt::format(
"Error in creating dump entry, errormsg({}), OBJECTPATH({}), "
"ID({}), TIMESTAMP({}), SIZE({}), FILENAME({})",
- e.what(), objPath.c_str(), id, stoull(msString),
+ e.what(), objPath.c_str(), id, timestamp,
std::filesystem::file_size(file), file.filename().c_str())
.c_str());
return;