[PATCH phosphor-host-ipmid v4] fix set sel time
OpenBMC Patches
openbmc-patches at stwcx.xyz
Tue Nov 24 08:30:26 AEDT 2015
From: Norman James <njames at us.ibm.com>
---
storagehandler.C | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/storagehandler.C b/storagehandler.C
index 1459f94..9c53b7c 100644
--- a/storagehandler.C
+++ b/storagehandler.C
@@ -2,7 +2,9 @@
#include <string.h>
#include <stdint.h>
#include <time.h>
+#include <sys/time.h>
#include <arpa/inet.h>
+#include <sys/types.h>
#include "storagehandler.h"
#include "storageaddsel.h"
@@ -52,14 +54,25 @@ ipmi_ret_t ipmi_storage_set_sel_time(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_request_t request, ipmi_response_t response,
ipmi_data_len_t data_len, ipmi_context_t context)
{
- unsigned int *bufftype = (unsigned int *) request;
+ uint32_t* secs = (uint32_t*)request;
printf("Handling Set-SEL-Time:[0x%X], Cmd:[0x%X]\n",netfn, cmd);
- printf("Data: 0x%X]\n",*bufftype);
-
- g_sel_time = *bufftype;
+ printf("Data: 0x%X]\n",*secs);
+ struct timeval sel_time;
+ sel_time.tv_sec = letoh32(*secs);
ipmi_ret_t rc = IPMI_CC_OK;
+ int rct = settimeofday(&sel_time, NULL);
+
+ if(rct == 0)
+ {
+ system("hwclock -w");
+ }
+ else
+ {
+ printf("settimeofday() failed\n");
+ rc = IPMI_CC_UNSPECIFIED_ERROR;
+ }
*data_len = 0;
return rc;
}
--
2.6.3
More information about the openbmc
mailing list