views:

145

answers:

2

The clock_t implications in time.h released with Turbo C++ v1.01 are good only up to 0.0545XX seconds, meaning any timing I want to do with higher precision is impossible with that library.

I was wondering if anyone knew a good library or method available to elder TurboC++ that I could use instead of time.h calls for better precision?

A: 

Use Windows QueryPerformanceCounter (and QueryPerformanceFrequency).

pascal
Not from Turbo C. They are 32-bit API functions.
Hans Passant
Yeah, I did not notice the TurboC version...
pascal
+1  A: 

Is this the ancient Turbo C++ for DOS? I recognise that number as the ~1/18th of a second of the default DOS performance timer.

You can speed up the timer, but you'll have to write an interrupt routine that intercepts that timer and only passes on some of the interrupts. Or you'll get strange behavior from other parts of DOS. I have code for this somewhere which I may be able to dig out.

pjc50
If the OP just needs to measure short times, he can do it by reading the timer registers directly (accounting correctly for wrapping). That way one doesn't need to mess around with ISRs.
Will Dean
Good point, that's probably the way to go.
pjc50