Time Provider
You can register for a ark::pipeline::TimeProviderPtr
object by using the StageInterface
’s
method pipeline_time_provider
.
This allows you to fetch the current pipeline time at any point within your stage, or to translate monotonic time into pipeline time. This can be useful when using external counters, as a means to know the pipeline time that a monotonic time point occurred at.
This is typically used in stages that interact with real hardware or non-deterministic I/O. As such, there are a few caveats with this for the SimClock executor:
- It is impossible to translate monotonic time to pipeline time when running with the SimClock, you can only fetch the current type.
- The current time will be ‘fixed’ (unchanging) for the duration of your callbacks.
A valid use case would be to convert the steady_clock::time_point
(or system_clock::time_point
)
coming in on UDP/TCP packet data into a pipeline time.