From 62234e39a8533362a20f106c64326ed69f430006 Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Thu, 1 Apr 2021 11:08:20 -0700 Subject: [PATCH] use jc.utils.timestamp instead of jc.utils.parse_datetime_to_timestamp() --- jc/parsers/upower.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/jc/parsers/upower.py b/jc/parsers/upower.py index a1f2b134..9cad95c0 100644 --- a/jc/parsers/upower.py +++ b/jc/parsers/upower.py @@ -227,14 +227,11 @@ def process(proc_data): updated_list = entry['updated'].replace('(', '').replace(')', '').split() entry['updated'] = ' '.join(updated_list[:-3]) entry['updated_seconds_ago'] = int(updated_list[-3]) - entry['updated_epoch'] = None - entry['updated_epoch_utc'] = None - timestamps = jc.utils.parse_datetime_to_timestamp(entry['updated']) - if timestamps['timestamp_naive']: - entry['updated_epoch'] = timestamps['timestamp_naive'] - if timestamps['timestamp_utc']: - entry['updated_epoch_utc'] = timestamps['timestamp_utc'] + if entry['updated']: + ts = jc.utils.timestamp(entry['updated']) + entry['updated_epoch'] = ts.naive + entry['updated_epoch_utc'] = ts.utc # top level boolean conversions bool_list = ['power_supply', 'has_history', 'has_statistics', 'on_battery', 'lid_is_closed', 'lid_is_present']