2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-27 19:37:44 +00:00

Cleanly degrade on bad BMC time format

If a BMC provided a time, but the format was not compliant,
it caused an exception.  Now gracefully degrade to not
doing time correction if time cannot be parsed.

Change-Id: I5ab45d51913232016bb55d3595ea30188bbfe2e7
This commit is contained in:
Jarrod Johnson 2019-05-07 10:08:48 -04:00
parent b8254fb5b9
commit 70bf3cf165

View File

@ -1028,6 +1028,7 @@ class Command(object):
correction = timedelta(0)
if currtime:
currtime = _parse_time(currtime)
if currtime:
now = datetime.now(tz.tzoffset('', 0))
try:
correction = now - currtime