clock()

Prototype: clock_t clock(void);
Header File: time.h (C) or ctime (C++)
Explanation: This function returns the number of clock ticks (the CPU time taken) the program has taken. To convert to the number of seconds, divide by CLOCKS_PER_SEC, which is defined in time.h




Example:
//Example will run a loop, and then print the number of clock ticks and 
//number of seconds used
#include <ctime>
#include <iostream>

using namespace std;

int main()
{
    for(int x=0; x<1000; x++)
    {
        cout<<endl;
    }
    cout<<"Clock ticks: "<<clock()<<" Seconds: "<<clock()/CLOCKS_PER_SEC;
}
Other Functions