summaryrefslogtreecommitdiffstats
path: root/selutility.cpp
diff options
context:
space:
mode:
authorTom Joseph <tomjoseph@in.ibm.com>2017-06-30 18:40:30 +0530
committerPatrick Williams <patrick@stwcx.xyz>2017-07-19 19:08:03 +0000
commit399fd92ec41cd23a9a5cb30f5d41397e5d8c6306 (patch)
tree5779770dd8ce74fcf4b921ca29b86a93f17471f9 /selutility.cpp
parentdcb106713ca9dd63db9f88c4fe92d543e927388d (diff)
downloadphosphor-host-ipmid-399fd92ec41cd23a9a5cb30f5d41397e5d8c6306.zip
phosphor-host-ipmid-399fd92ec41cd23a9a5cb30f5d41397e5d8c6306.tar.gz
Get the timestamp from the log entry
Change-Id: Id00f6e1e6f65c17babc5d06abe1b9fc39a4de8b8 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Diffstat (limited to 'selutility.cpp')
-rw-r--r--selutility.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/selutility.cpp b/selutility.cpp
index 0107515..3f9d9ab 100644
--- a/selutility.cpp
+++ b/selutility.cpp
@@ -182,6 +182,38 @@ GetSELEntryResponse convertLogEntrytoSEL(const std::string& objPath)
return internal::prepareSELEntry(objPath, iter);
}
+std::chrono::seconds getEntryTimeStamp(const std::string& objPath)
+{
+ sdbusplus::bus::bus bus{ipmid_get_sd_bus_connection()};
+
+ auto service = ipmi::getService(bus, logEntryIntf, objPath);
+
+ using namespace std::string_literals;
+ static const auto propTimeStamp = "Timestamp"s;
+
+ auto methodCall = bus.new_method_call(service.c_str(),
+ objPath.c_str(),
+ propIntf,
+ "Get");
+ methodCall.append(logEntryIntf);
+ methodCall.append(propTimeStamp);
+
+ auto reply = bus.call(methodCall);
+ if (reply.is_method_error())
+ {
+ log<level::ERR>("Error in reading Timestamp from Entry interface");
+ elog<InternalFailure>();
+ }
+
+ sdbusplus::message::variant<uint64_t> timeStamp;
+ reply.read(timeStamp);
+
+ std::chrono::milliseconds chronoTimeStamp(
+ sdbusplus::message::variant_ns::get<uint64_t>(timeStamp));
+
+ return std::chrono::duration_cast<std::chrono::seconds>(chronoTimeStamp);
+}
+
} // namespace sel
} // namespace ipmi
OpenPOWER on IntegriCloud