Add Get SEL Time UTC Offset function

The current ipmi does not support the time zone acquisition command.
This command is a standard ipmi command. In the ipmi specification,
the corresponding NetFn=0x0A and Cmd=0x5C.
Returns the offset in minutes from UTC to SEL (local) time.
The offset is a 16 bit signed integer with two complements.
LS byte comes first.
(Range from - 1440 to 1440)

tested:
When the current time zone is East Zone 8,
ipmitool raw 0x0A 0x5C
e0 01

Signed-off-by: Xiaochao Ma <maxiaochao@inspur.com>
Change-Id: I74edfe4f18201bec801b021e69a88231e51473a5
diff --git a/storagehandler.cpp b/storagehandler.cpp
index d12fb3b..cf5ef5e 100644
--- a/storagehandler.cpp
+++ b/storagehandler.cpp
@@ -629,6 +629,26 @@
     return ipmi::responseSuccess();
 }
 
+/** @brief implements the get SEL timezone command
+ *  @returns IPMI completion code plus response data
+ *   -current timezone
+ */
+ipmi::RspType<int16_t> ipmiStorageGetSelTimeUtcOffset()
+{
+    time_t timep;
+    struct tm* gmTime;
+    struct tm* localTime;
+
+    time(&timep);
+    localTime = localtime(&timep);
+    auto validLocalTime = mktime(localTime);
+    gmTime = gmtime(&timep);
+    auto validGmTime = mktime(gmTime);
+    auto timeEquation = (validLocalTime - validGmTime) / 60;
+
+    return ipmi::responseSuccess(timeEquation);
+}
+
 /** @brief implements the reserve SEL command
  *  @returns IPMI completion code plus response data
  *   - SEL reservation ID.
@@ -878,6 +898,12 @@
                           ipmi::storage::cmdSetSelTime,
                           ipmi::Privilege::Operator, ipmiStorageSetSelTime);
 
+    // <Get SEL Timezone>
+    ipmi::registerHandler(ipmi::prioOpenBmcBase, ipmi::netFnStorage,
+                          ipmi::storage::cmdGetSelTimeUtcOffset,
+                          ipmi::Privilege::User,
+                          ipmiStorageGetSelTimeUtcOffset);
+
     // <Get SEL Entry>
     ipmi_register_callback(NETFUN_STORAGE, IPMI_CMD_GET_SEL_ENTRY, NULL,
                            getSELEntry, PRIVILEGE_USER);