time from rostime::now doesn't change
Hi, when I use ros::Time::now().toSec() function to get time, the time from rostime::now doesn't change . But time from date command and gettimeofday function is changing.
I think there is a bug in rostime. Could you please fix the bug? Br, xiaofyao
Edit: This is an occasional problem, the first time we've had this problem with ros in a long time.
In this function, the ros time is printed every second, but the ros time doesn't change:
int main(int argc, char *argv[])
{
ros::init(argc, argv);
while(1)
{
printf("ros time is : %u\n", ros::Time::now().toSec());
sleep(1);
}
}
The code run results on the problem device :
ros time is : 2917579440
ros time is : 2917579440
ros time is : 2917579440
ros time is : 2917579440
ros time is : 2917579440
ros time is : 2917579440
That part of the ROS 1 infrastructure has been around for at least 12 years.
Age does not guarantee code is bug free, but it would be surprising if no one has run into this before.
Could you please show a sample of code that exhibits this problem? And please also tell us a little bit about how you start things (ie: launch files,
rosrun
, with or without Gazebo, etc).