How do you create a timer without using "Sleep()"? [SOLVED] | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 5

How do you create a timer without using "Sleep()"? [SOLVED]

I Would like to make a timer. I used google and the only option I found was to use "sleep()". I also read that it was a bad practice to make you system sleep. If you know how to do it, I appreciate your input.

21st Apr 2017, 10:56 PM
Manual
Manual - avatar
4 ответов
+ 10
@Dirty That would have issues with different FrameRates. Perhaps this could be of help? https://msdn.microsoft.com/en-us/library/dd492468.aspx
21st Apr 2017, 11:42 PM
Rrestoring faith
Rrestoring faith - avatar
+ 5
@Rrestoring Thank you, That is exactly what I need.
21st Apr 2017, 11:53 PM
Manual
Manual - avatar
+ 5
@Dirty For java, I think it may be something that you would have to import.
21st Apr 2017, 11:55 PM
Manual
Manual - avatar
+ 2
you could use a variable such as time=0; then run a loop with an increase time++; and a check for a certain number if(time>100){ //do something } *Ok, my example is in Java. I don't know cop, but the principle remains the same
21st Apr 2017, 11:13 PM
LordHill
LordHill - avatar