qmeng@sirius.UVic.CA (06/29/91)
Hi there, Does anybody has a BORLAND C++/TURBO C timing routine that can give elapsed execution time to the accuracy of millisecond. 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. Can anybody help me out of this ? I have little experience in C programming. Thanks in advance. Max Meng | qmeng@sirius.UVic.ca | 604-721-8660 | Expect what you did to others. ------------------------------------------------------------------------------- ((( In 3-D and Stereo Where Available )))
mouse@thunder.mcrcim.mcgill.edu (der Mouse) (07/01/91)
In article <1991Jun28.221556.16859@sol.UVic.CA>, qmeng@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 comp.sys.ibm.pc.{hardware,programmer}. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu