Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix set sel time #40

Merged
merged 1 commit into from
Nov 23, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 16 additions & 4 deletions storagehandler.C
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <string.h>
#include <stdint.h>
#include <time.h>
#include <sys/time.h>
#include <arpa/inet.h>

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