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

If you look at the implementation of the SimpleActionServer, you'll see that you can use the Date object to get the time (in milliseconds):

var currentTime = new Date();
var secs = Math.floor(currentTime.getTime()/1000);
var nsecs = Math.round(1000000000*(currentTime.getTime()/1000-secs));
that.statusMessage.header.stamp.secs = secs;
that.statusMessage.header.stamp.nsecs = nsecs;