Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

roscpp: ros::Time::now() not working correctly on windows (ros ticket #3790) #160

Closed
tfoote opened this issue Jan 31, 2013 · 3 comments
Closed
Labels

Comments

@tfoote
Copy link
Member

tfoote commented Jan 31, 2013

Environment
Windows 7 Pro 32bit on Intel E2180 processor

Code
ros::init(argc, argv, "test");
while(1)
{
ros::Time t= ros::Time::now();
Sleep(10);
printf("%ld,%ld\n",t.sec, t.nsec);
}
Output
1323720814,945105920
1323720814,955104384
1323720815,965104384
1323720815,975104384
1323720815,985106432
1323720815,995106432
1323720815,6104896
1323720815,16103872
1323720815,27103360
1323720815,37104384
Note the t.sec field does not increase at the same time as t.nsec cycle over 1e9 to 0

I trace down the problem to the code
void ros_walltime(uint32_t& sec, uint32_t& nsec) as in
http://www.ros.org/doc/api/rostime/html/time_8cpp_source.html#l00095

A standalone (without any roslib)win32 console application using the same code snippet in ros_walltime to obtain the (sec,nsec) further suggests this code is the source of problem. (code attached)

trac data:

@tfoote
Copy link
Member Author

tfoote commented Jan 31, 2013

[tingfan] Reformatting of [ticket:3790 tingfan]:

Environment

Windows 7 Pro 32bit on Intel E2180 processor

Code and Output
{{{

ros::init(argc, argv, "test");
while(1)
{
    ros::Time t= ros::Time::now();
    Sleep(10);
    printf("%ld,%ld\n",t.sec, t.nsec);
}

Output
1323720814,945105920
1323720814,955104384
1323720815,965104384
1323720815,975104384
1323720815,985106432
1323720815,995106432
1323720815,6104896
1323720815,16103872
1323720815,27103360
1323720815,37104384
Note the t.sec field does not increase at the same time as t.nsec cycle over 1e9 to 0
}}}

I trace down the problem to the code
void ros_walltime(uint32_t& sec, uint32_t& nsec) as in
http://www.ros.org/doc/api/rostime/html/time_8cpp_source.html#l00095

A standalone (without any roslib)win32 console application using the same code snippet in ros_walltime to obtain the (sec,nsec) further suggests this code is the source of problem. (code attached)

@stonier
Copy link
Contributor

stonier commented Jun 27, 2013

We tried reproducing this here without success.

I put a couple of commits into rostime quite some time ago - perhaps these fixed the situation, or it's a problem only on certain machines/platforms.

I'd recommend closing this and re-opening it if necessary (i.e. someone else manages to reproduce the problem).

@dirk-thomas
Copy link
Member

Thank you.

@dirk-thomas dirk-thomas removed the major label Mar 3, 2016
contradict pushed a commit to contradict/ros_comm that referenced this issue Aug 12, 2016
contradict pushed a commit to contradict/ros_comm that referenced this issue Aug 12, 2016
contradict pushed a commit to contradict/ros_comm that referenced this issue Aug 12, 2016
…imestamp

rqt_console: fix loading timestamps from file (fix ros#160)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants