Jump to content
  • Advertisement
Sign in to follow this  
onehundred

Timing Functions?

This topic is 5399 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hey guys, i'm experimenting with search trees, where i have a message printed to the user wether the tree is traversing left or right. However when i run it, everything's a blur (as in it processes it fast). So is there any timer funtions that can say make the message wait five seconds, then move onto the next one. example: Traversing right ...5 secs... Traversing left ...5 secs... so i can see the steps more clearly?

Share this post


Link to post
Share on other sites
Advertisement
the "wait" function in c/c++ is generally sleep() [or Sleep() for windows] man sleep or msdn search Sleep will provide usage. Note though that sleep will cause the entire thread to stop, not just the messages.

Share this post


Link to post
Share on other sites
You could do a number of things:
1) call your print function every few seconds.
2) print to file instead of the screen.
3) only print when the state changes.

i dont think the sleep function is a good idea. freezing your thread is never good.

instead, you could do this:

static long ot=0;
const long duration = 5;
long nt = 0; time( &nt);
if( ot + duration < nt ){
printTextToScreen( str);
time( &ot);
}


you might use a different time function, such as GetTickCount

Share this post


Link to post
Share on other sites
Or if it's just a console application that you're just fiddling with you could just pipe it into more...

<compile testapp.exe>
[from the command line:]
testapp | more

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!