|
From: Zdenek S. <st...@us...> - 2016-04-10 13:57:43
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "ipmitool".
The branch, master has been updated
via c7169bc27ee407206e768dece2c3f026e02aee02 (commit)
from d6ca800da2cde1ecba0e4a9561b683607a6a9cb2 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit c7169bc27ee407206e768dece2c3f026e02aee02
Author: Vasant Hegde <heg...@li...>
Date: Wed Mar 30 14:07:16 2016 +0530
ID:437 - sel: Fix "sel time set <time>"
Presently 'sel time set' doesn't account 'minute' difference between timezone.
So depending on host timezone it may set time to +/-30 mins. This patch adds
minute difference to delta_hour caluclation so that it sets time properly.
output without patch:
# ./ipmitool sel time get
03/24/2016 12:34:03
# ./ipmitool sel time set "03/24/2016 12:34:03"
03/24/2016 12:04:03
# ./ipmitool sel time get
03/24/2016 12:06:09
output with patch:
# ./ipmitool sel time get
03/30/2016 08:49:47
# ./ipmitool sel time set "03/30/2016 08:09:47"
03/30/2016 08:09:47
# ./ipmitool sel get
03/30/2016 08:09:57
Signed-off-by: Vasant Hegde <heg...@li...>
diff --git a/lib/ipmi_sel.c b/lib/ipmi_sel.c
index 910011e..1127929 100644
--- a/lib/ipmi_sel.c
+++ b/lib/ipmi_sel.c
@@ -2739,24 +2739,26 @@ 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 = {0};
- int gt_year,gt_yday,gt_hour,lt_year,lt_yday,lt_hour;
+ int gt_year,gt_yday,gt_hour,gt_min,lt_year,lt_yday,lt_hour,lt_min;
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;
+ gt_min=tm_tmp->tm_min;
memset(&*tm_tmp, 0, sizeof(struct tm));
tm_tmp=localtime(&t);
lt_year=tm_tmp->tm_year;
lt_yday=tm_tmp->tm_yday;
lt_hour=tm_tmp->tm_hour;
+ lt_min=tm_tmp->tm_min;
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);
+ t += (delta_hour * 60 * 60) + (lt_min - gt_min) * 60;
}
timei = (uint32_t)t;
-----------------------------------------------------------------------
Summary of changes:
lib/ipmi_sel.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
hooks/post-receive
--
ipmitool
|