BORLAND C++/TURBO C Timing Routine in M.S. Accuracy

der Mouse mouse at
Mon Jul 1 12:42:01 AEST 1991

In article <1991Jun28.221556.16859 at sol.UVic.CA>, qmeng at sirius.UVic.CA writes:

> Does anybody has a BORLAND C++/TURBO C timing routine that can give
> elapsed execution time to the accuracy of millisecond.

(Questions generally end with `?', not `.'.)

> The timing functions supplied with BORLAND C++ and TURBO C only give
> a resolution of about 55 MS.  I phoned BORLAND once, they directed me
> to use ftime() which also has a resolution of about 55 MS.

The person who told you that was incompetent; whoever it was should
have known what I'm about to explain.  (Particularly true of someone
whose job is to help people with problems like yours.)

You are up against a hardware limitation.  You didn't say, but your
posting makes it clear, that you're using a MS-DOS (or similar)
machine.  Such machines have clocks that tick at, nominally, 18.2Hz,
which is once every approximately 54.945 milliseconds.  Since there is
no standard, or even pseudo-standard, hardware support for better timer
resolution, there isn't much that the compiler people can do about it.

Depending on your display, you may be able to use its vertical retrace
bit as a 30, 50, or 60 Hz clock.  Maybe.

Since this really isn't a C question but rather an IBM-PC-family
machine question, I'm crossposting and redirecting followups to{hardware,programmer}.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse at

More information about the Comp.lang.c mailing list