Why is my C++ timer stuck in infinite loop?
From: wwwolf (abuse_at_alltel.net)
Date: 03/29/05
- Next message: Ulrich Eckhardt: "Re: Why is my C++ timer stuck in infinite loop?"
- Previous message: David White: "Re: Member Functions"
- Next in thread: Ulrich Eckhardt: "Re: Why is my C++ timer stuck in infinite loop?"
- Reply: Ulrich Eckhardt: "Re: Why is my C++ timer stuck in infinite loop?"
- Reply: Anthony Borla: "Re: Why is my C++ timer stuck in infinite loop?"
- Reply: Karl Heinz Buchegger: "Re: Why is my C++ timer stuck in infinite loop?"
- Reply: wwwolf: "Re: [THANX!] Why is my C++ timer stuck in infinite loop?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 29 Mar 2005 02:57:06 -0500
I'm trying to make a five second timer based on what little code I know. I don't
understand why my timer is not updating for the next iteration.
Thanx again for your help and instruction,
// Example for 5 second timer
#include <iostream>
#include <ctime>
int main()
{
using std::cout;
using std::cin;
time_t timerStart = ((time (0)) +5); // Add 5 sec to current time
time_t timerFinish = time (0); // Get current time
for ( ; timerStart >= timerFinish ; ) // Compare the two values loop
{
cout << ".";
time_t timerFinish = time (0); // Update timerFinish for next iteration
}
cout << "Five seconds have passed.\n";
return 0;
}
- Next message: Ulrich Eckhardt: "Re: Why is my C++ timer stuck in infinite loop?"
- Previous message: David White: "Re: Member Functions"
- Next in thread: Ulrich Eckhardt: "Re: Why is my C++ timer stuck in infinite loop?"
- Reply: Ulrich Eckhardt: "Re: Why is my C++ timer stuck in infinite loop?"
- Reply: Anthony Borla: "Re: Why is my C++ timer stuck in infinite loop?"
- Reply: Karl Heinz Buchegger: "Re: Why is my C++ timer stuck in infinite loop?"
- Reply: wwwolf: "Re: [THANX!] Why is my C++ timer stuck in infinite loop?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|