C语言精确获得消耗时间

来源:互联网 发布:堆排序算法java实现 编辑:程序博客网 时间:2024/05/29 11:41
    1. #include<stdlib.h>    
    2. #include<time.h>      
    3. int main()    
    4. {    
    5.    time_t tBegin;    
    6.    tBegin=clock();    
    7.    //代码段      
    8.   time_t tCost=clock()-tBegin;  
    9.    return 0;  
    10. }