phoenix6.timestamp
#
Module Contents#
- class phoenix6.timestamp.TimestampSource(*args, **kwds)#
Bases:
enum.Enum
Source of the timestamp.
- System = (0,)#
Timestamp as reported by the CANivore. This timestamp is captured when the CANivore receives the signal value.
The CANivore is synchronized to the system monotonic clock and benefits from reduced latency over the :attr:System: timestamp.
When used with CANivore, the only inaccuracy in this measurement is latency from CAN bus arbitration.
- CANivore = (1,)#
This timestamp source requires Phoenix Pro.
Timestamp as reported by the device. This timestamp is captured when the device transmits the signal value. Because it is timestamped in the device, it is the most accurate timestamp source.
This timestamp is synchronized to the CANivore clock, which itself is synchronized to the system monotonic clock. As a result, the this timestamp source requires a CANivore.
It can be assumed there is no latency between this timestamp and when the data was taken.
- Device = (2,)#
- class phoenix6.timestamp.Timestamp(time: phoenix6.units.second, source: TimestampSource, is_valid: bool = True)#
Information about the timestamp of a signal.
- property time: phoenix6.units.second#
Get the time of this timestamp
- Returns:
Time of this timestamp
- Return type:
second
- property source: TimestampSource#
Get the source of this timestamp
- Returns:
Source of this timestamp
- Return type:
- property is_valid: bool#
Get whether this timestamp is valid or not
- Returns:
True if this timestamp is valid
- Return type:
bool
- update(time: phoenix6.units.second, source: TimestampSource, valid: bool)#
Update this timestamp with provided information
- Parameters:
time (second) – Time in seconds
source (TimestampSource) – Timestamp source
valid (bool) – Whether the timestamp is valid or not
- get_latency() phoenix6.units.second #
Get the latency of this timestamp compared to now
- Returns:
Difference between now and this timestamp
- Return type:
second