#include<stdio.h>
#include<stdlib.h>
#include "time.h"

int main( void )  
{  
    long    i = 1000000000L;  
    
    clock_t start_time, end_time;  
    double  duration_time;  
    start_time=clock();

while( i-- )  ;

end_time = clock();  
    duration_time = (double)(end_time-start_time) / CLOCKS_PER_SEC;  
    printf( "duration: %lf seconds\n", duration_time );     
}

C语言如何计算程序运行时间;如何获得C程序运行时间;C语言统计算法运行时间

05-07 15:12