Search the Community
Showing results for tags 'TimerInit'.
Found 4 results
does anyone know what exactly TimerDiff() is doing with the integer returned by TimerInit() in order to get milliseconds? Just trying to find out if i can use the integer timerinit() returns in a slightly different way to the norm because it will save me a great deal of effort. ( hoping to save the integer in a db and query rows where the difference in current time integer is > x where x = whatever the integer needs to be to = y hours )
Hi everyone. I have a question and wasn't able to find any answer for this. What is the maximum value/limit for TimerInit & TimerDiff. I mean, If I use TimerInit() in my script, how long can it 'last'? How long will I be able to read it with TimerDiff()? I realize that the result of TimerDiff isn't an Integer. It's a floating number and I am not sure what the maximum value is. I would like my program to use $Time = TimerInit() today, and then I'll be able to use TimerDiff($Time) tomorrow or even the day after. Is this possible? and what happens if TimerDiff exceeds the maximum value (if there is any)?
So I have some timers which I reset periodically, but my problem is that they don't wait for the functions before them to finish and in a strange way reset beforehand. -snip- timerinit doesnt wait the mouseclick and sleep functions to finish
I am trying to write a script that keeps accurate time regardless of how long functions take to preform their actions. I thought this would be pretty straight forward. I use several while loops to keep track of days, hours, mins, and secs. But for some reason it is not working correctly. Global $day, $hour, $min, $sec $time = TimerInit() While 1 ;Main Loop $hour = 0 ;Reset hours While $hour <= 23;Loop while hours is less than 24 hours $min = 0 ;Reset minutes While $min <= 59 ;Loop while minutes is less than 60 minutes $sec = 0 ;Reset seconds While $sec <= 59 ;Loop while seconds is less than 60 seconds $show_sec = $sec $dif = TimerDiff($time) ;checks how many milliseconds has passed since timer start $sec = int($dif/1000) ;counts the seconds sleep(50) ;cpu sleep if $sec <> $Show_Sec then ConsoleWrite($sec&@crlf) WEnd ;End Sec Loop $time = $time + 60 * 1000 ; add one minute to initial time to keep accuracy $min = $min + 1 ;Add 1 minute Consolewrite("!Min: "&$min&@crlf) WEnd ;End Min Loop $hour = $hour + 1 ;Add 1 hour WEnd ;End Hour loop $day = $day + 1 ; Add 1 day WEnd [autoit] For the first minute it goes according to plan but after that For some reason it does not reset the sec to 0 after the first minute. I am sure that this is tied to the $time = $time + 60 *1000 I don't believe that I am adding 60 seconds to the ticks from the init time but this is what the autoit examples show on how to add ticks. Any ideas?