FIRST ANSWER
It all depends on what you have to do between times:
If you don't have to react to events meanwhile time is passing you can use
Sleep()
.
If you need to react to something meanwhile time is passing... then it will be a little bit more difficult.
You can set
timers[
^] (see
also[
^]).
Keep in mind that the timer itself won't do all the job, you will have to continue handling the events you expect to happen, the timer will make it easier to know when the time has passed.
Probably putting the code to handle events inside a loop will be enough for you.
SECOND ANSWER
Your question/comment look like this one:
automotive machine timer[
^]. See the answer there.
Apart of that, if you want to be able to react to any event meanwhile you are waiting that desired amount of time, you can't do that... See my other answer (link posted before) where I explain a little bit how to react to those behaviors.
You should do it by putting a small time base (t10ms) and each time the time base has happened then check the conditions (and add up each cycle the amount of time in order to be able to check for the maximum allowed time) or put a timer (SetTimer) and react to a variable while waiting for the events (you could kill the timer each time the desired event fires).
...
THIRD ANSWER
Even I would stick with the sample code posted in the second answer link, if you want you can do something like:
m_nTimer = SetTimer(1, x*1000, NULL); while ((not bLimit) and (not bInputsignal)) {
sleep(10); }
KillTimer(m_nTimer);
In your timer routine you should modify the bLimit value to TRUE.
Good luck!