Challenge 10 – How to pause for less than 55ms? in C++

Difficulty ![]() |
![]() |
This Challenge was proposed for the now defunct C/C++ programming list CWORLD in 1999.The source code of the challenge has been updated to modern C++, but maintaining the essence of the challenge, which its original author wanted to transmit.
Date: 24-XI-2000
Created by: José Luis De la Cruz
Challenge winner: No winner
This challenge is currently obsolete, since it was a specific question to run on the DOS operating system, back in the year 2000, but we leave it proposed, in case you suddenly have a solution for a popular operating system such as Windows, Linux or other.
Statement
How to pause for less than 55ms?
where:
ms = milliseconds = thousandths of a second.
The time entered must be a whole number of milliseconds.
Clarifications
As we know, the function delay, gettime, etc; depend on the time processor of our PC (Timer), which works with time units called ticks, where each tick is equivalent to approximately 55ms. The question is how to design a function that puts a pause for 1ms, 2ms,
3ms,…,55ms, 56ms, 57ms, 58ms,… onwards ; and of course… also do the coding in C/C++.
To standardize the responses, the function must have the following statement:
//Precision Delay
//mseg = número entero de milisegundos pdelay( unsigned mseg );
void pdelay( unsigned mseg );
AND FINALLY I CAN ONLY SAY …. BEST OF LUCK AND MAY THE BEST CODE WIN….
If you liked this challenge remember to leave a comment in our guestbook