Parse dates in HistoryList->Dates
Currently, the dates in HistoryList are ignored and imported just as binary strings. For example:
In [33]: td["TDGraph"]["XInterpretation"]["TData"]["HistoryList"]
Out[33]:
{'Number Of History Entries': 1,
'Dates': b'\xe6\x07\x0b\x00\x1c\x00\x0b\x001\x00:\x00\xad\x03',
'Histories': 'ID changed from 37 to 54.',
'Types': 2}
This can cause problems for the serialization of the object later as a binary string is not JSON serializable.
What we need to do is to parse it according to the docs Dates (uint32 if empty, but uint16 otherwise).
Here is an example:
import struct
binary_string = td["TDGraph"]["XInterpretation"]["TData"]["HistoryList"]["Dates"]
# binary_string: b'\xe6\x07\x0b\x00\x1c\x00\x0b\x001\x00:\x00\xad\x03'
size = int(len(binary_string)/2)
date = struct.unpack(f'<{size}H', binary_string)
date = datetime.datetime(*date)
# date: datetime.datetime(2022, 11, 28, 11, 49, 58, 941)