From 0f6e2c14fcb69f664c29083ec5207326f842dfdc Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Fri, 26 Mar 2021 14:57:19 -0700 Subject: [PATCH] simplify timestamp failure logic --- jc/parsers/upower.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/jc/parsers/upower.py b/jc/parsers/upower.py index 11183757..a1f2b134 100644 --- a/jc/parsers/upower.py +++ b/jc/parsers/upower.py @@ -231,11 +231,10 @@ def process(proc_data): entry['updated_epoch_utc'] = None timestamps = jc.utils.parse_datetime_to_timestamp(entry['updated']) - if timestamps: - if timestamps['timestamp_naive']: - entry['updated_epoch'] = timestamps['timestamp_naive'] - if timestamps['timestamp_utc']: - entry['updated_epoch_utc'] = timestamps['timestamp_utc'] + if timestamps['timestamp_naive']: + entry['updated_epoch'] = timestamps['timestamp_naive'] + if timestamps['timestamp_utc']: + entry['updated_epoch_utc'] = timestamps['timestamp_utc'] # top level boolean conversions bool_list = ['power_supply', 'has_history', 'has_statistics', 'on_battery', 'lid_is_closed', 'lid_is_present']