添加头文件:#include<time>
定义时间变量:clock_t start,end;
记录开始时间:start = clock();
记录结束时间:end =clock();
计算运行时间:double seconds1=(double)(end - start)/CLOCKS_PER_SEC;
#include <iostream>
#include "math.h"
#include <armadillo>
#include <time.h>
#include "6aix_robot.h"
using namespace std;
int main()
{
clock_t start1,end1,start2,end2;
int i,j;
C6AxisData MZ204;
start1 = clock(); /*记录起始时间*/
MZ204.Cal_pos_by_theta();
end1 =clock();
double seconds1=(double)(end1 - start1)/CLOCKS_PER_SEC;
cout<<"time1:"<<seconds1<<endl;
return 0;
}