2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-28 11:57:34 +00:00

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
This commit is contained in:
Jarrod Johnson 2015-05-06 16:45:30 -04:00
parent dd53abfb99
commit 8c8ce504c1

View File

@ -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):