#include #include #include using namespace std; int main() { time_t internalTime = time(0); cout << "The current internal time is " << internalTime << endl; clock_t cpuTime = clock(); // store CPU time used so far // A silly loop to waste time for (int i = 0; i < 1000000; i++) internalTime = time(0); cpuTime = clock() - cpuTime; // calculate CPU time for the loop to run double secsUsed = static_cast(cpuTime)/CLOCKS_PER_SEC; cout << "The loop took " << secsUsed << " cpu secs to run. " << endl; return 0; }