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就是间隔时间

 

 

posted on 2011-12-28 09:18  蚂蚁跳楼  阅读(140)  评论(0)    收藏  举报