Return current BMC time for the Get SEL Time command
Since we use the journal timestamp as the SEL timestamp, we don't
need a separate host time, so override the Get SEL Time command to
return the current BMC time.
Tested:
Confirmed that 'ipmitool sel time get' returns the same time as
'date'.
Change-Id: I3ea59963d0149bd5c38b0425fc594e1f2f9db1d6
Signed-off-by: Jason M. Bills <jason.m.bills@linux.intel.com>
diff --git a/src/storagecommands.cpp b/src/storagecommands.cpp
index 219c4dc..22a9dcd 100644
--- a/src/storagecommands.cpp
+++ b/src/storagecommands.cpp
@@ -1012,6 +1012,18 @@
return ipmi::responseSuccess(ipmi::sel::eraseComplete);
}
+ipmi::RspType<uint32_t> ipmiStorageGetSELTime()
+{
+ struct timespec selTime = {};
+
+ if (clock_gettime(CLOCK_REALTIME, &selTime) < 0)
+ {
+ return ipmi::responseUnspecifiedError();
+ }
+
+ return ipmi::responseSuccess(selTime.tv_sec);
+}
+
ipmi::RspType<> ipmiStorageSetSELTime(uint32_t selTime)
{
// Set SEL Time is not supported
@@ -1058,6 +1070,11 @@
ipmi::storage::cmdClearSel, ipmi::Privilege::Operator,
ipmiStorageClearSEL);
+ // <Get SEL Time>
+ ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage,
+ ipmi::storage::cmdGetSelTime,
+ ipmi::Privilege::Operator, ipmiStorageGetSELTime);
+
// <Set SEL Time>
ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage,
ipmi::storage::cmdSetSelTime,