A Timer component Bug? an Ultra simple experiment!

I write a c# component to test timer component:


and connect a timer to it,interval is 1 second.
so the number add 1 every one second.
then i change interval to “10ms”,so the number will add 100 every one second
but in fact it not,almost need 3 seconds to add every 100.
it seems a bug in timer.
who can explain that,thank you!

Seems like compiling and executing your c# script takes around 20 milliseconds? Or a delay due to the rendering and update of the display?

I’d assume the timer tries to trigger a new solution every 10 ms. But I guess if the solver is busy, that’ll get delayed.

thank you dsonntag,tomorrow i go to check.

Maybe this can help

 private void RunScript(bool run, bool reset, int ms, ref object A)
        (ms, doc => {Component.ExpireSolution(false);});

    if(reset) c = 0;

    A = c;

  // <Custom additional code> 
  int c = 0;


Timer2.0_Forum.gh (4.5 KB)

This does exactly the same thing as the other example with the timer? Also here it takes 3 seconds to count to 100. And my guess is if I start some heavy calculations in the background that will even be more. Which is also what is to be expected, the solution including the redraw will create a delay.

thank you ,i tried your code above,and when set ms =1000,it add 10 every second,i donnot know why can you explain it ,thank you~