ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Is it safe to change system date/time during execution

asked 2011-07-26 20:14:21 -0500

Victor Lopez gravatar image

updated 2011-07-30 12:45:32 -0500

tfoote gravatar image

Reading on how ros Time is implemented, it looks like it uses system wall-time.

Would it be safe to change system time when ros nodes are running?

We plan to synchronize the time between robots using NTP on startup using Wi-Fi.

But if a robot was powered on out of Wi-Fi range, started all it's nodes, and then (once in Wi-Fi range) changed it's system time using NTP, we are afraid that those nodes would start acting weird.

This question is both for C++ and python implementation of Time.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2011-07-26 23:11:21 -0500

dornhege gravatar image

It is not safe as you already suspected. Timestamps might jump and this might lead to inconsistencies. If you sync with NTP before, there shouldn't be much difference, though.

It is recommended to use chrony for your application, although there still is the problem that the times might get out of sync. In a comparably short time that should not matter unless you are synching high-frequency sensor data between different machines.

edit flag offensive delete link more


I was thinking about using a Clock Server that publishes time based on monotonic time, therefore a change on system time wouldn't cause timestamp jumps, I'll have to test it which harmful effects this has.
Victor Lopez gravatar image Victor Lopez  ( 2011-07-26 23:18:21 -0500 )edit
I think that wouldn't solve the problem. A clock server still has to run on one of the machines and once you have a disconnect the problem is again the sync. You can see one systems clock as a clock server.
dornhege gravatar image dornhege  ( 2011-07-27 03:40:04 -0500 )edit
This is why chrony is recommended. It doesn't jump the clock it skews the rate to synchronize instead of jumping time.
tfoote gravatar image tfoote  ( 2011-07-30 12:44:55 -0500 )edit

Question Tools


Asked: 2011-07-26 20:14:21 -0500

Seen: 1,105 times

Last updated: Jul 26 '11