I want function to count the time

fulla's Avatar, Join Date: Mar 2011
Light Poster
hi..

i want help for function that can count the time from start function to eand it ..

in c++ thr is function but i never use it i want help how can i use it..
thanks
0
virxen's Avatar, Join Date: Nov 2009
Pro contributor
Code:
#include <stdio.h>
#include <time.h>

int main ( ) {
time_t t;
clock_t start, end;
long i,count= 100000000;

start = clock();

time(&t);

printf(ctime(&t));
printf( "Counting to %ld\n", count );

for (i=0; i < count; i ++);

end = clock();

printf( "That took %f seconds and I counted up to %ld", (((double)(end-start)/CLOCKS_PER_SEC)), count );
getchar();
return 0;
}