1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-19 00:17:51 +02:00

simplify timestamp failure logic

This commit is contained in:
Kelly Brazil
2021-03-26 14:57:19 -07:00
parent 51813da619
commit 0f6e2c14fc

View File

@ -231,11 +231,10 @@ def process(proc_data):
entry['updated_epoch_utc'] = None entry['updated_epoch_utc'] = None
timestamps = jc.utils.parse_datetime_to_timestamp(entry['updated']) timestamps = jc.utils.parse_datetime_to_timestamp(entry['updated'])
if timestamps: if timestamps['timestamp_naive']:
if timestamps['timestamp_naive']: entry['updated_epoch'] = timestamps['timestamp_naive']
entry['updated_epoch'] = timestamps['timestamp_naive'] if timestamps['timestamp_utc']:
if timestamps['timestamp_utc']: entry['updated_epoch_utc'] = timestamps['timestamp_utc']
entry['updated_epoch_utc'] = timestamps['timestamp_utc']
# top level boolean conversions # top level boolean conversions
bool_list = ['power_supply', 'has_history', 'has_statistics', 'on_battery', 'lid_is_closed', 'lid_is_present'] bool_list = ['power_supply', 'has_history', 'has_statistics', 'on_battery', 'lid_is_closed', 'lid_is_present']