标签:
uint32_t midtime;
static struct timeval startstart,midmid;
while (ros::ok())
{
gettimeofday(&startstart,NULL);
usleep(10000); //10ms
gettimeofday(&midmid,NULL);
midtime = 1000000*(midmid.tv_sec - startstart.tv_sec)+(midmid.tv_usec - startstart.tv_usec);//us,1s=10^6us=10^3ms
printf("midtime = %u\n",midtime);
}
标签:
原文地址:http://www.cnblogs.com/cj2014/p/5068000.html