From 8c8ce504c173ae0c147365f0d78baf07f9b811d0 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 6 May 2015 16:45:30 -0400 Subject: [PATCH] Fix time correction code When the change to refactor the event and event_data happened, the time correction code was not correctly modified. Rectify the mistake. Change-Id: I8317539761456f1c5621745989fbd8ebfc973455 --- pyghmi/ipmi/events.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pyghmi/ipmi/events.py b/pyghmi/ipmi/events.py index 394e784c..64de558a 100644 --- a/pyghmi/ipmi/events.py +++ b/pyghmi/ipmi/events.py @@ -303,10 +303,12 @@ def _fix_sel_time(records, ipmicmd): record = records[index] if 'timecode' not in record or record['timecode'] == 0xffffffff: continue - if record['event'] == 'Clock time change: After': + if (record['event'] == 'Clock time change' and + record['event_data'] == 'After'): newtimestamp = record['timecode'] trimindexes.append(index) - elif record['event'] == 'Clock time change: Before': + elif (record['event'] == 'Clock time change' and + record['event_data'] == 'Before'): if newtimestamp: if record['timecode'] < 0x20000000: correctearly = True @@ -351,6 +353,8 @@ def _fix_sel_time(records, ipmicmd): record['timestamp'] = time.strftime( '%Y-%m-%dT%H:%M:%S', time.localtime( time.time() - age)) + for index in trimindexes: + del records[index] class EventHandler(object):