Files
rust-chrono-lldb-formatter/formatters/chrono.py
2025-12-06 09:07:21 +08:00

15 lines
856 B
Python

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')