mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-11 02:57:22 +00:00
Bernard Manjou fix for sel and sdr timestamp reporting issues
This commit is contained in:
parent
34dd10feda
commit
9689fe6199
@ -748,7 +748,7 @@ ipmi_pef_get_status(struct ipmi_intf * intf)
|
|||||||
#endif
|
#endif
|
||||||
ts = (time_t)timei;
|
ts = (time_t)timei;
|
||||||
|
|
||||||
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", localtime(&ts));
|
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", gmtime(&ts));
|
||||||
|
|
||||||
ipmi_pef_print_str("Last SEL addition", tbuf);
|
ipmi_pef_print_str("Last SEL addition", tbuf);
|
||||||
ipmi_pef_print_2xd("Last SEL record ID", rsp->data[5], rsp->data[4]);
|
ipmi_pef_print_2xd("Last SEL record ID", rsp->data[5], rsp->data[4]);
|
||||||
|
@ -3819,7 +3819,7 @@ ipmi_sdr_timestamp(uint32_t stamp)
|
|||||||
memset(tbuf, 0, 40);
|
memset(tbuf, 0, 40);
|
||||||
if (stamp)
|
if (stamp)
|
||||||
strftime(tbuf, sizeof (tbuf), "%m/%d/%Y %H:%M:%S",
|
strftime(tbuf, sizeof (tbuf), "%m/%d/%Y %H:%M:%S",
|
||||||
localtime(&s));
|
gmtime(&s));
|
||||||
return tbuf;
|
return tbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ ipmi_sel_timestamp(uint32_t stamp)
|
|||||||
static char tbuf[40];
|
static char tbuf[40];
|
||||||
time_t s = (time_t)stamp;
|
time_t s = (time_t)stamp;
|
||||||
memset(tbuf, 0, 40);
|
memset(tbuf, 0, 40);
|
||||||
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", localtime(&s));
|
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", gmtime(&s));
|
||||||
return tbuf;
|
return tbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,7 +232,7 @@ ipmi_sel_timestamp_date(uint32_t stamp)
|
|||||||
{
|
{
|
||||||
static char tbuf[11];
|
static char tbuf[11];
|
||||||
time_t s = (time_t)stamp;
|
time_t s = (time_t)stamp;
|
||||||
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y", localtime(&s));
|
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y", gmtime(&s));
|
||||||
return tbuf;
|
return tbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +241,7 @@ ipmi_sel_timestamp_time(uint32_t stamp)
|
|||||||
{
|
{
|
||||||
static char tbuf[9];
|
static char tbuf[9];
|
||||||
time_t s = (time_t)stamp;
|
time_t s = (time_t)stamp;
|
||||||
strftime(tbuf, sizeof(tbuf), "%H:%M:%S", localtime(&s));
|
strftime(tbuf, sizeof(tbuf), "%H:%M:%S", gmtime(&s));
|
||||||
return tbuf;
|
return tbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1821,7 +1821,7 @@ ipmi_sel_get_time(struct ipmi_intf * intf)
|
|||||||
time = (time_t)timei;
|
time = (time_t)timei;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", localtime(&time));
|
strftime(tbuf, sizeof(tbuf), "%m/%d/%Y %H:%M:%S", gmtime(&time));
|
||||||
printf("%s\n", tbuf);
|
printf("%s\n", tbuf);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -1866,6 +1866,28 @@ ipmi_sel_set_time(struct ipmi_intf * intf, const char * time_string)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
//modify UTC time to local time expressed in number of seconds from 1/1/70 0:0:0 1970 GMT
|
||||||
|
struct tm * tm_tmp;
|
||||||
|
int gt_year,gt_yday,gt_hour,lt_year,lt_yday,lt_hour;
|
||||||
|
int delta_hour;
|
||||||
|
tm_tmp=gmtime(&t);
|
||||||
|
gt_year=tm_tmp->tm_year;
|
||||||
|
gt_yday=tm_tmp->tm_yday;
|
||||||
|
gt_hour=tm_tmp->tm_hour;
|
||||||
|
tm_tmp=localtime(&t);
|
||||||
|
lt_year=tm_tmp->tm_year;
|
||||||
|
lt_yday=tm_tmp->tm_yday;
|
||||||
|
lt_hour=tm_tmp->tm_hour;
|
||||||
|
delta_hour=lt_hour - gt_hour;
|
||||||
|
if ( (lt_year > gt_year) || ((lt_year == gt_year) && (lt_yday > gt_yday)) )
|
||||||
|
delta_hour += 24;
|
||||||
|
if ( (lt_year < gt_year) || ((lt_year == gt_year) && (lt_yday < gt_yday)) )
|
||||||
|
delta_hour -= 24;
|
||||||
|
|
||||||
|
t += (delta_hour * 60 * 60);
|
||||||
|
}
|
||||||
|
|
||||||
timei = (uint32_t)t;
|
timei = (uint32_t)t;
|
||||||
req.msg.data = (uint8_t *)&timei;
|
req.msg.data = (uint8_t *)&timei;
|
||||||
req.msg.data_len = 4;
|
req.msg.data_len = 4;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user