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

Revision history [back]

click to hide/show revision 1
initial version

For example, the images in the following list are written chronologically, we can clearly see the time stamps with 8-digit nsec disrupting the time order.

[..]

Who can tell me the reason?

There are only 1e9 nanoseconds in a second, so to see timestamps with the same nanoseconds is inevitable. Also: they are not "disrupting the time order", as the timestamps are always seconds:nanoseconds (see wiki/roscpp/Overview/Time for more info on how time is represented in ROS). Take a look at your screenshot: you'll find them to be in proper chronological order.

How to avoid this case?

If you are asking how to avoid filename collisions in case of the nanosecond parts occurring more than once: just include the second part as well.

For example, the images in the following list are written chronologically, we can clearly see the time stamps with 8-digit nsec disrupting the time order.

[..]

Who can tell me the reason?

There are only 1e9 nanoseconds in a second, so to see timestamps with the same nanoseconds is inevitable. Also: they are not "disrupting the time order", as the timestamps are always seconds:nanoseconds (see wiki/roscpp/Overview/Time for more info on how time is represented in ROS). Take a look at your screenshot: you'll find them to be in proper chronological order.

How to avoid this case?

If you are asking how to avoid filename collisions in case of the nanosecond parts occurring more than once: just include the second part as well.

Edit: if you are worried that files will not be chronologically sorted by your OS (because 4e7 would come after 1e9 (in the same second) fi), then pad the nanosecond part of the timestamps with zeros before you include it in the filename.

For example, the images in the following list are written chronologically, we can clearly see the time stamps with 8-digit nsec disrupting the time order.

[..]

Who can tell me the reason?

There are only 1e9 nanoseconds in a second, so to see timestamps with the same nanoseconds is inevitable. Also: they are not "disrupting the time order", as the timestamps are always seconds:nanosecondsof the form seconds.nanoseconds (see wiki/roscpp/Overview/Time for more info on how time is represented in ROS). Take a look at your screenshot: you'll find them to be in proper chronological order.

How to avoid this case?

If you are asking how to avoid filename collisions in case of the nanosecond parts occurring more than once: just include the second part as well.

Edit: if you are worried that files will not be chronologically sorted by your OS (because 4e7 would come after 1e9 (in the same second) fi), then pad the nanosecond part of the timestamps with zeros before you include it in the filename.