Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Maybe you should realize that what you're trying to do is impossible, given the current browser implementation and hardware.</p> <p>On my computer the time it takes for Chrome to repaint a 3x16 area on the screen is about 300 ms. To have 1000 such updates it would take 5 minutes. You want to do it one second. You are clearly asking too much from your hardware.</p> <p>If you really need that much performance (as if...) inside a webbrowser, you should write a native plugin, still I doubt you will be able to redraw a part of your screen that many times a second (at least you would need a 1000hz monitor, which would be silly to produce).</p> <p>Rethink your application logic: even if you show a millisecond clock, the human eye can't see anything that changes faster than 72 times in a second, so you could as well update your clock a more reasonable ~25 times a second and no one would be able to see the difference. It would still be a website I wouldn't want use, because it would slow down my browser, but at least it will not freeze.</p> <p>Using a number which doesn't have 2 and 5 factors will ensure that last digit shown won't repeat too often</p> <pre><code>setInterval("showClock()", 37); </code></pre> <p>Edit:</p> <p>There's a bigger issue in your code, as pointed out by Shadow Wizard, that is you are calling setInterval <em>every time you update your clock</em>, which sets up a lot of timers, as fast as possible. You should be calling that function only once, for example in the onload event:</p> <pre><code>&lt;body onload="startClock()"&gt; </code></pre> <p>and then add the <code>startClock</code> function:</p> <pre><code>function startClock() { setInterval("showClock()", 1); } </code></pre> <p>and remove the <code>setInterval</code> call from <code>showClock</code>:</p> <pre><code>function showClock() { var now = new Date; time = fill(now.getHours()) + " : " + fill(now.getMinutes()) + " : " + fill(now.getSeconds()) + " : " + fill(now.getMilliseconds()); document.getElementById("clock").innerHTML = time; // remove! //setTimeout("showClock()",1); } </code></pre> <p>I am still suggesting that you should not need to update your page that often, but that's your call.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload