What happens to an Up Timer when it overflows?

Hi,

Does it just continue from 0, is it a good id to launch an uptimer with no limit to have a millisecond time base? I want to use it in order to have the looping time of every running charts.

regards,

Pierre

Based upon my experiences, an up timer will continue to run up unless it is stopped or reset (regardless of whether it is past the target or not).

Hi Pierre,

If you want to know how long it takes a looping chart to run, can I offer the following code…
(Note, this is not my code, but a guy I worked with, he is a way better programmer than I am, I just love his ‘reverse’ thinking with this solution)
Put this code into a block that gets run once per loop.


//the chart has run through once, so stop the timer
PauseTimer(chart_loop_time);

//keep track of how many times this chart has run through
IncrementVariable(chart_cycle_number);

//keep track of how much time in total this chart has been running
chart_cycle_time_total = chart_cycle_time_total + (1.0 - chart_loop_time);

//display how long in Msec this chart takes to run
chart_cycle_time = chart_cycle_time_total/chart_cycle_number;

//load 1 second back into the timer (assumes the chart will loop in under a second).
chart_loop_time = 1.0;


The nice thing about doing it this way is that the timer will never overflow and you get both how long it takes to loop and also how many seconds (since the strategy has been running) this chart has been ‘active’.

Lets know if this does what you are looking for.

Ben.

thanks Ben,

I was doing something similar, with only one timer for all my charts, with a timer reset after a few hours. The chart timing is not supposed to run all the time.