38 #include "rosgraph_msgs/Clock.h"
42 #define SIM_TIME_INCREMENT_US 10000
51 int main(
int argc,
char** argv)
59 node_priv.
param<
int>(
"sim_speedup", sim_speedup, 1);
63 int rv = gettimeofday(&
start, NULL);
66 rv = gettimeofday(&now, NULL);
69 ROS_ERROR(
"Invalid return from gettimeofday: %d", rv);
73 rosgraph_msgs::Clock sim_time;
74 sim_time.clock.sec = now.tv_sec -
start.tv_sec;
75 sim_time.clock.nsec = now.tv_usec * 1000;
78 ROS_INFO(
"Starting simulation time publisher at time: %d.%d", sim_time.clock.sec, sim_time.clock.nsec);
85 while (sim_time.clock.nsec > 1000000000)
87 sim_time.clock.nsec -= 1000000000;