CTRE Phoenix Pro C++ 23.0.12
|
Information about the timestamp of a signal. More...
#include <ctre/phoenixpro/Timestamp.hpp>
Public Types | |
enum class | TimestampSource { System = 0 , CANivore = 1 , Device = 2 } |
Source of the timestamp. More... | |
Public Member Functions | |
Timestamp (units::time::second_t time, TimestampSource source) | |
Construct a new Timestamp for the given source. More... | |
Timestamp () | |
Construct a new invalid Timestamp. More... | |
units::time::second_t | GetTime () const |
Get the time in seconds as reported from this timestamp. More... | |
TimestampSource | GetSource () const |
Get the source of this timestamp. More... | |
units::time::second_t | GetLatency () const |
Get the latency of this timestamp compared to now. More... | |
bool | IsValid () const |
Returns if this Timestamp is valid or not. More... | |
Information about the timestamp of a signal.
|
strong |
Source of the timestamp.
Enumerator | |
---|---|
System | Timestamp as reported by the system. This timestamp is captured when the system receives the signal value. This timestamp is present on all systems and is guaranteed to be monotonic. However, this timestamp is the least accurate due to processing delays within the system. |
CANivore | 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 TimestampSource::System timestamp. On the native roboRIO CAN bus, this timestamp is equivalent to the TimestampSource::System timestamp. When used with CANivore, the only inaccuracy in this measurement is latency from CAN bus arbitration. |
Device | This timestamp source is not currently implemented in this version of 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 is itself synchronized to the system monotonic clock. As a result, this timestamp source requires a CANivore. It can be assumed there is no latency between this timestamp and when the data was taken. |
|
inline |
Construct a new Timestamp for the given source.
time | The time in seconds |
source | The timestamp source |
|
inline |
Construct a new invalid Timestamp.
|
inline |
Get the latency of this timestamp compared to now.
|
inline |
Get the source of this timestamp.
|
inline |
Get the time in seconds as reported from this timestamp.
|
inline |
Returns if this Timestamp is valid or not.