According to rclcpp::timer docs, std::chrono::steady_clock
is used,
using WallTimer = GenericTimer< CallbackType, std::chrono::steady_clock >
Quoting from std::chrono::steady_clock docs,
Class std::chrono::steady_clock
represents a monotonic clock. The time
points of this clock cannot decrease
as physical time moves forward and the
time between ticks of this clock is
constant. This clock is not related to
wall clock time (for example, it can
be time since last reboot), and is
most suitable for measuring intervals.
So to answer your question, Yes, it is guaranteed never to jump backwards (or forwards) due to midnight, daylight savings time, user changing the system clock, clock adjustments via NTP, etc
Originally posted by ijnek with karma: 460 on 2021-08-10
This answer was ACCEPTED on the original site
Post score: 2
Original comments
Comment by shonigmann on 2021-08-10:
And adding a small note for anyone who is curious, from std::chrono::duration docs,
Note: each of the predefined duration types up to hours covers a range of at least ±292 years.
So overflow also won't be an issue, at least in our lifetime