[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

broken clock() in i386 2.6-beta



I need to time how long specific functions of one of my c++ programs for 
class is taking.  

I have:

#include <time.h>
clock_t start, finish;

then:

  start=clock();
  cout << "start: " << start << endl;
  while(dictFile >> dictionaryWord) {
	/* builds the crypt'd dictionary */
  }
  finish=clock();
  cout << "finish: " << finish << endl;

but clock() always returns 0:

start: 0
finish: 0

time'ing it says:
real    0m2.587s
user    0m0.000s
sys     0m0.000s

Anyone have any ideas? Can I use something other than clock() to end up
with how many ms it takes to build the dictionary?

This code under SunOS 5.6 gives:
start: 0
finish: 51910000

which I can get into ms with no problems.

Thanks,
Jeremie