I am using FastRTPS to communicate between multiple processes on a single Linux system. They are exchanging information in packets. Every packet has a time stamp independent of its sending or receiving time. This way the conveyed information can be used correctly.
I was thinking on using:
uint64_t time_in_microseconds = std::chrono::duration_cast
<std::chrono::microseconds>(std::chrono::steady_clock::now()
.time_since_epoch()).count();
to get the timestamp for the packets.
However, is steady clock steady across processes on a single system? Or only inside a single process?
If not, how much does the system clock vary under normal conditions? How much would it move "back in time"? (not adjusting it manually, no internet connection, no time change, etc.)
Thank you
Edit:
The packets will be used in state estimation and control algorithms. Sensor data will, for example, move from a sensor reading process to a state estimation process. State information will move from the estimation process to the control process. That is why I need to be able to measure intervals consistently across the system. Neither system_clock nor steady_clock seem to provide what I need. System_clock is consistent, but its not monotonic. And steady clock is monotonic and consistent inside a single process, but as far as I can see, it is not consistent across the system? Or is it?