22 int ret = clock_gettime(CLOCK_HOST_REALTIME, &ts);
39 int ret = clock_gettime(CLOCK_HOST_REALTIME, &ts);
55 const uint64_t one_E9 = 1000000000ULL;
58 uint32_t sec32_part = nsec64 / one_E9;
59 uint32_t nsec32_part = nsec64 % one_E9;
61 return ros::Time(sec32_part, nsec32_part);
66 const uint64_t one_E9 = 1000000000ll;
69 uint64_t sec64_part = nsec64 / one_E9;
70 uint64_t nsec64_part = nsec64 % one_E9;
72 return ros::Time(sec64_part, nsec64_part);
const bool enable_sim()
Use a simulated clock source.
static nsecs ticks2nsecs(const ticks t)
const RTT::Seconds host_offset_from_rtt()
Get the difference in seconds between rtt_wall_now() and host_wall_now()
const ros::Time host_wall_now()
Get the current time according to CLOCK_HOST_REALTIME or the wall time.
static boost::shared_ptr< SimClockThread > GetInstance()
Get an instance to the singleton SimClockThread or NULL.
static TimeService * Instance()
bool setActivity(base::ActivityInterface *new_act)
virtual Seconds getPeriod() const
boost::shared_ptr< rtt_rosclock::SimClockThread > sim_clock_thread
void use_manual_clock()
Use manual clock updates.
void use_ros_clock_topic()
Use ROS /clock topic for time measurement.
static boost::shared_ptr< SimClockThread > Instance()
Get an instance to the singleton SimClockThread or create one.
const bool set_sim_clock_activity(RTT::TaskContext *t)
Set a TaskContext to use a periodic simulation clock activity.
const ros::Time rtt_wall_now()
Get the current wall time according to RTT.
void update_sim_clock(const ros::Time new_time)
Update the current simulation time and trigger all simulated TaskContexts.
const bool disable_sim()
Do't use a simulated clock source.
const ros::Time host_now()
Get the current time according to CLOCK_HOST_REALTIME or the simulation time.
const ros::Time rtt_now()
Get the current time according to RTT.
static Logger::LogFunction endlog()