Not a bug

IR.SetTimeout executes too quickly.

rocfusion 9 years ago in iRidium Script updated by Oksana (expert) 9 years ago 4

Create a new project
Add the following script
function hello(){
IR.Log("hello again")
IR.SetTimeout(600, hello)

Run the project,  I would expect the function hello to execute anytime after 600 milliseconds.  This is not the case.  It always executes before.


We aim to make the activation time to be ideal but it is not possible due to the following reasons:

1. The operating system is not a real time OS. 
2. Overload of the iRidium core increases th margin of error 
3. The scripts being interpreted increae the margin of error and impair accuracy of the checking systems 

So the accuracy of activation of the SetInterval and SetTimeout functions cannot be 100%.

I understand this, there should be a minimum time, since I have seen that sometimes the timeouts execute  between 10 and 50 even though I specified 100 or higher 

This is more apparent when there are more drivers in the project.


Such work is a feature of the client launch.
We do not plan to change the procedure in V2.x. Perhaps it will be done in V3.x.

At the moment we can recommend increasing the time of SetTimeout.