diff --git a/devices/clients/SDP_statistics.py b/devices/clients/SDP_statistics.py index f8baff46c6c8a8e589118fe7bad8a07af984ed4f..b8417ef58876b2fbad65bdf0771a830237233ae0 100644 --- a/devices/clients/SDP_statistics.py +++ b/devices/clients/SDP_statistics.py @@ -212,13 +212,16 @@ class StatisticsPacket(object): return unpack("<Q",self.packet[24:32])[0] def timestamp(self) -> datetime: - """ Returns the timestamp of the data in this packet. """ + """ Returns the timestamp of the data in this packet. + + Returns datetime.min if the block_serial_number in the packet is not set (0), + Returns datetime.max if the timestamp cannot be represented in python (likely because it is too large). """ try: return datetime.fromtimestamp(self.block_serial_number * self.block_period(), timezone.utc) except ValueError: # Let's not barf anytime we want to print a header - return datetime.fromtimestamp(0, timezone.utc) + return datetime.max def header(self) -> dict: """ Return all the header fields as a dict. """