From 7463891c53f3670710dfa72ed1422431c274fe4a Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Thu, 1 Apr 2021 11:13:02 -0700 Subject: [PATCH] use new timestamp class --- jc/parsers/last.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/jc/parsers/last.py b/jc/parsers/last.py index 6fdaaaac..4d6d87ba 100644 --- a/jc/parsers/last.py +++ b/jc/parsers/last.py @@ -154,10 +154,12 @@ def process(proc_data): entry['logout'] = 'gone - no logout' if 'login' in entry and re.match(r'.*\d\d:\d\d:\d\d \d\d\d\d.*', entry['login']): - entry['login_epoch'] = jc.utils.parse_datetime_to_timestamp(entry['login'])['timestamp_naive'] + timestamp = jc.utils.timestamp(entry['login']) + entry['login_epoch'] = timestamp.naive if 'logout' in entry and re.match(r'.*\d\d:\d\d:\d\d \d\d\d\d.*', entry['logout']): - entry['logout_epoch'] = jc.utils.parse_datetime_to_timestamp(entry['logout'])['timestamp_naive'] + timestamp = jc.utils.timestamp(entry['logout']) + entry['logout_epoch'] = timestamp.naive if 'login_epoch' in entry and 'logout_epoch' in entry: entry['duration_seconds'] = int(entry['logout_epoch']) - int(entry['login_epoch'])