formatters
This commit is contained in:
14
formatters/chrono.py
Normal file
14
formatters/chrono.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from datetime import datetime,timedelta
|
||||
|
||||
print('loading lldb chrono formatter')
|
||||
|
||||
def GetSummary(valobj, internal_dict):
|
||||
yof = valobj.GetChildMemberWithName('datetime').GetChildMemberWithName('date').GetChildMemberWithName('yof').GetChildMemberWithName('__0').GetChildMemberWithName('__0').GetValue();
|
||||
if (yof == None):
|
||||
yof = valobj.GetChildMemberWithName('datetime').GetChildMemberWithName('date').GetChildMemberWithName('yof').GetChildMemberWithName('__0').GetChildMemberWithName('0').GetValue();
|
||||
secs = valobj.GetChildMemberWithName('datetime').GetChildMemberWithName('time').GetChildMemberWithName('secs').GetValue();
|
||||
year = int(yof) >> 13
|
||||
day_of_year = (int(yof) & 8191) >> 4;
|
||||
date = datetime(year -1, 12, 31) + timedelta(days=day_of_year) + timedelta(seconds=int(secs))
|
||||
return date.strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
Reference in New Issue
Block a user