How to get timer current count?
#1

Hi guys,
Any chance we can get how much time the SetTimer is counting? like imagine it has 5 min of countdown and some time passes, can we do a line that gets how much time is left?
Cumpz,
Vasco
Reply
#2

yes.

You create a var for hold the timer initial time.

Код:
new timerInitTime;
timerInitTime = gettime();
SetTimerEx("yourfunc", 666666, true, "i", YourParam);
Then, to get the time :

Код:
timeCount = (gettime() - timerInitTime;
Notice that the time you get is in seconds.
You can multiply the result with 1000 to get the time in miliseconds.
Reply
#3

You can use gettime() for seconds, or GetTickCount() for milliseconds. Multiplying seconds by 1000 won't give you an accurate measurement of milliseconds.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)