hookshy Well-Known Member Licensed User Longtime User Sep 9, 2013 #1 I am using a timer to show every 300 ms a diferent bitmap image inside of a imageview depending on some values that read from a file . What happens if the time to process the code inside timer_click sub requires more than 300 ms ?(searching big array of data, in my case I use exccesive substring2 function). I noticed that my battery got low very fast though i was downloaded the source text every 15 seconds with http.util . When using timers do you have to wory about the time the timer ticks in order to let the processor handle the code inside?
I am using a timer to show every 300 ms a diferent bitmap image inside of a imageview depending on some values that read from a file . What happens if the time to process the code inside timer_click sub requires more than 300 ms ?(searching big array of data, in my case I use exccesive substring2 function). I noticed that my battery got low very fast though i was downloaded the source text every 15 seconds with http.util . When using timers do you have to wory about the time the timer ticks in order to let the processor handle the code inside?
lagore Active Member Licensed User Longtime User Sep 9, 2013 #2 If you are worried that your processing will overrun the length of the timer tick then disable the timer in the timer tick event, do all of your processing then re enable then timer, otherwise you might get into some nasty loops. Upvote 0
If you are worried that your processing will overrun the length of the timer tick then disable the timer in the timer tick event, do all of your processing then re enable then timer, otherwise you might get into some nasty loops.
hookshy Well-Known Member Licensed User Longtime User Sep 10, 2013 #3 thank you Iagore. It is correct if how I tried to calculate time to execute the code inside timer Code: Copy sub timer_tick tick_i=datetime.now 'my code tick_f=datetime.now log(tick_i-tick_f) end sub Upvote 0
thank you Iagore. It is correct if how I tried to calculate time to execute the code inside timer Code: Copy sub timer_tick tick_i=datetime.now 'my code tick_f=datetime.now log(tick_i-tick_f) end sub
Erel B4X founder Staff member Licensed User Longtime User Sep 10, 2013 #4 When using timers do you have to wory about the time the timer ticks in order to let the processor handle the code inside? Click to expand... No. The next tick event will only fire x milliseconds after the previous event was completed (x = Timer.Interval). Upvote 0
When using timers do you have to wory about the time the timer ticks in order to let the processor handle the code inside? Click to expand... No. The next tick event will only fire x milliseconds after the previous event was completed (x = Timer.Interval).