Changeset 7a9c068 in ammosreader for ammosreader/PDW.py


Ignore:
Timestamp:
05/17/23 20:33:45 (2 years ago)
Author:
Enrico Schwass <ennoausberlin@…>
Branches:
AmmosSource, guix
Children:
79e8edb
Parents:
9dc7beb
Message:

check timestamps

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ammosreader/PDW.py

    r9dc7beb r7a9c068  
    2424        :rtype: PDW
    2525        """
    26         assert(len(byte_string) == 32)
     26        if (len(byte_string) != 32):
     27            raise TypeError("Too many bytes")
    2728
    2829        parts = struct.unpack('<Q4s4s4s4s4s4s', byte_string)
    2930        nanoseconds = (parts[0])
     31        if (np.datetime64('now', 'ns').astype(int) >= nanoseconds):
     32            raise OverflowError("Timestamp invalid")
    3033        time_of_arrival = np.datetime64(nanoseconds, 'ns')
    3134
Note: See TracChangeset for help on using the changeset viewer.