summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2015-11-23 16:43:43 -0600
committerPatrick Williams <patrick@stwcx.xyz>2015-11-23 16:43:43 -0600
commit781d2036ea3a2aada511174efec53c55159f61b4 (patch)
treea75992593939c14f87fe67b4498b77b11baedab1
parentf0d4635fa2b417bd0eef3f19ae98e56ec615e703 (diff)
parent8233044e78b91cb036d343012365d2135eeea2aa (diff)
downloadphosphor-host-ipmid-781d2036ea3a2aada511174efec53c55159f61b4.tar.gz
phosphor-host-ipmid-781d2036ea3a2aada511174efec53c55159f61b4.zip
Merge pull request #40 from nkskjames/master
fix set sel time
-rw-r--r--storagehandler.C20
1 files changed, 16 insertions, 4 deletions
diff --git a/storagehandler.C b/storagehandler.C
index 1459f94..f3e2532 100644
--- a/storagehandler.C
+++ b/storagehandler.C
@@ -2,6 +2,7 @@
#include <string.h>
#include <stdint.h>
#include <time.h>
+#include <sys/time.h>
#include <arpa/inet.h>
#include "storagehandler.h"
@@ -52,14 +53,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 = le32toh(*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;
}
OpenPOWER on IntegriCloud