Skip to content

Commit

Permalink
fix set sel time
Browse files Browse the repository at this point in the history
  • Loading branch information
nkskjames committed Nov 23, 2015
1 parent f0d4635 commit 5c983d6
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions storagehandler.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
#include <string.h>
#include <stdint.h>
#include <time.h>
#include <sys/time.h>
#include <arpa/inet.h>
#include <sys/endian.h>

#include "storagehandler.h"
#include "storageaddsel.h"
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 5c983d6

Please sign in to comment.