i want to calculate the exact run time of my program in seconds....i used clock() function of time.h library...
what i did is that i made two clock_t type objects...
initialized one of them in the start of main() function and the other in the end..
and calculated the difference..as shown...

main()
{

clock_t start,end;
    start1=clock();
....
....
....
my code.
....
...
...
end=clock();
cout<<start-end<<endl;
}

but i want to know what does that difference shows...what's its unit...seconds..milliseconds..microseconds..or depends on clock frequency...???
Am using Dev-c++...

>what's its unit...seconds..milliseconds..microseconds..
>or depends on clock frequency...???
From a standard library perspective, you don't know. Everything after this point assumes non-portable things about your implementation.

You can divide the result by CLOCKS_PER_SEC and get the result in seconds, but be sure to cast one of those operands to a floating-point type or you'll likely get a lot of zeros unless your program takes more than a second.

But where is CLOCK_PER_SEC declared...i divided it..but it gives compile time error...that it is undeclared...i have included ctime.h library...but still it gives the error...what's the solution??

and what is CLOCK_PER_SEC..what does it denote??

>what's the solution??
Spell it correctly. It's CLOCKS_PER_SEC, not CLOCK_PER_SEC, and it's defined in ctime.

>the output is in seconds,right??
That's what I said:

You can divide the result by CLOCKS_PER_SEC and get the result in seconds

This question has already been answered. Start a new discussion instead.