•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 427,101 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,143 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Programming Forums
Views: 181 | Replies: 5
![]() |
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,197
Reputation:
Rep Power: 38
Solved Threads: 932
use the time() function if you only want accuracy to the second, of clock() for milliseconds.
Or you could create another thread that does the timer stuff. When time is expired the timer thread tells the main thread to quit.
const time_t MaxTime = 60*60; // one minute timer
time_t t1 = time(0); // start the timer
bool done = false;
while( !done )
{
time_t t2 = time(0); // get current time
if( (t2-t1) >= maxtime)
done = true;
// do some processing here
}Or you could create another thread that does the timer stuff. When time is expired the timer thread tells the main thread to quit.
Last edited by Ancient Dragon : May 19th, 2008 at 1:49 pm.
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
![]() |
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Previous Thread: Makefile for C++ one file programs
- Next Thread: compressed file project



Linear Mode