linux 常用函数

        struct timezone tz;
        struct timeval stHandleHistoryRecordFactlyStartTime;
        struct timeval stHandleHistoryRecordFactlyEndTime;
        gettimeofday(&stHandleHistoryRecordFactlyStartTime,&tz);
       dosomething();//处理一些函数的时间
        gettimeofday(&stHandleHistoryRecordFactlyEndTime,&tz);
       int iHandleHistoryRecordFactlyTime = (stHandleHistoryRecordFactlyEndTime.tv_sec - stHandleHistoryRecordFactlyStartTime.tv_sec)*1000 + (stHandleHistoryRecordFactlyEndTime.tv_usec - stHandleHistoryRecordFactlyStartTime.tv_usec)/1000;

 

    则 iHandleHistoryRecordFactlyTime就是间隔时间

 

 

你可能感兴趣的:(linux)