mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-19 00:17:51 +02:00
use new timestamp class
This commit is contained in:
@ -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'])
|
||||
|
Reference in New Issue
Block a user