You are here: irt.org | FAQ | JavaScript | Misc | Q1150 [ previous next ]
A possible approach is to see how quickly you can get the setTimeout() function to return.
The setTimeout() function accepts to parameters:
timer = window.setTimeout(code, delay);
where code is to be evaluated in delay number of milliseconds.
Normally the smaller the number of delay milliseconds the more unreliable the interval is - I suspect that the higher the processor speed and the less loaded the processor is then the interval decreases.
You could test the interval with something like:
<script language="JavaScript"><!-- function myFunction() { var date2 = new Date(); alert('interval = ' + (date2.getTime() - date1.getTime()) + ' milliseconds'); } var date1 = new Date(); setTimeout('myFunction()',0); // no delay //--></script>
Which on my machine (P133, GNU/Linux, Netscape Navigator 4.5) shows 56 milliseconds.