#include <iostream>
#include <sys/times.h>

using namespace std;

int main() {
  
  struct tms buf;       // look at the manual page for times for a
			// description of this structure.
  clock_t start, end;   // the type clock_t is usually a long int.

  start = times (&buf); // returns the processor time, in clock ticks,
			// elapsed since some fixed time in the past
			// -- usually the last reboot.
                        // buf now contains the individual time values
                        // (processor time, user time, etc.)

  // Do some work.
  for (int i = 0; i < 10000; i++) {
    for (int j = 0; j < 10000; j++)
      double x = 0.765 * 0.765;
  }

  end = times(&buf);

  // CLOCKS_PER_SEC is a constant that contains the number of clock
  // ticks per second
  cout << CLOCKS_PER_SEC << endl;

  // Print the raw values of start and end, and the elapsed processor
  // time in seconds.
  cout << start << " " << end << " " 
       << ((double)(end - start)/CLOCKS_PER_SEC) << endl; 

  return (0);

}