mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-11 19:17:22 +00:00
allow 'sel time set now' to set sel time to current client time
This commit is contained in:
parent
ecb214d423
commit
1e0164c253
@ -1254,7 +1254,7 @@ ipmi_sel_set_time(struct ipmi_intf * intf, const char * time_string)
|
|||||||
struct ipmi_rs * rsp;
|
struct ipmi_rs * rsp;
|
||||||
struct ipmi_rq req;
|
struct ipmi_rq req;
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
time_t time;
|
time_t t;
|
||||||
uint32_t timei;
|
uint32_t timei;
|
||||||
const char * time_format = "%m/%d/%Y %H:%M:%S";
|
const char * time_format = "%m/%d/%Y %H:%M:%S";
|
||||||
|
|
||||||
@ -1262,24 +1262,29 @@ ipmi_sel_set_time(struct ipmi_intf * intf, const char * time_string)
|
|||||||
req.msg.netfn = IPMI_NETFN_STORAGE;
|
req.msg.netfn = IPMI_NETFN_STORAGE;
|
||||||
req.msg.cmd = IPMI_SET_SEL_TIME;
|
req.msg.cmd = IPMI_SET_SEL_TIME;
|
||||||
|
|
||||||
/* Now how do we get our time_t from our ascii version? */
|
/* See if user requested set to current client system time */
|
||||||
if (strptime(time_string, time_format, &tm) == 0) {
|
if (strncasecmp(time_string, "now", 3) == 0) {
|
||||||
lprintf(LOG_ERR, "Specified time could not be parsed");
|
t = time(NULL);
|
||||||
return -1;
|
}
|
||||||
|
else {
|
||||||
|
/* Now how do we get our time_t from our ascii version? */
|
||||||
|
if (strptime(time_string, time_format, &tm) == 0) {
|
||||||
|
lprintf(LOG_ERR, "Specified time could not be parsed");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
t = mktime(&tm);
|
||||||
|
if (t < 0) {
|
||||||
|
lprintf(LOG_ERR, "Specified time could not be parsed");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
time = mktime(&tm);
|
timei = (uint32_t)t;
|
||||||
if (time < 0) {
|
|
||||||
lprintf(LOG_ERR, "Specified time could not be parsed");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
timei = (uint32_t)time;
|
|
||||||
req.msg.data = (uint8_t *)&timei;
|
req.msg.data = (uint8_t *)&timei;
|
||||||
req.msg.data_len = 4;
|
req.msg.data_len = 4;
|
||||||
|
|
||||||
#if WORDS_BIGENDIAN
|
#if WORDS_BIGENDIAN
|
||||||
time = BSWAP_32(time);
|
timei = BSWAP_32(timei);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rsp = intf->sendrecv(intf, &req);
|
rsp = intf->sendrecv(intf, &req);
|
||||||
@ -1293,6 +1298,8 @@ ipmi_sel_set_time(struct ipmi_intf * intf, const char * time_string)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ipmi_sel_get_time(intf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user