ros / roscpp_core

ros distribution sandbox
89 stars 116 forks source link

add MonotonicTime for use with timeouts #55

Closed flixr closed 7 years ago

flixr commented 7 years ago

Add a new MonotonicTime which uses CLOCK_MONOTONIC to prevent issues with time jumps.

If clock_gettime is not available it will fall back to normal wall time... but that shouldn't be the case on many Linux systems anymore.

Didn't look at the Windows implementation so far, also just returns wall time there.

See https://github.com/ros/bond_core/issues/16 and https://github.com/ros/nodelet_core/issues/35 for discussions why this could be useful.

flixr commented 7 years ago

@wjwwood @mikaelarguedas What do you think about adding a new time class like MonotonicTime (or maybe better named SteadyTime in accordance to C++11 naming?).

This would already make it much easier to compute time deltas that should not be affected by NTP, PTP, etc adjusting the system time.

flixr commented 7 years ago

closing in favor of #57