Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > How to write a browser based timer

Reply
Thread Tools

How to write a browser based timer

 
 
Dr J R Stockton
Guest
Posts: n/a
 
      02-22-2012
In comp.lang.javascript message <ht38k7pv0rr3vrinoj674dg70v5iic6tsq@4ax.
com>, Tue, 21 Feb 2012 13:45:13, Gene Wirchenko <(E-Mail Removed)> posted:

>
> Pause a second, update, then repeat will be inaccurate because of
>the execution time being indeterminate.
>


If you had read <http://www.merlyn.demon.co.uk/js-date0.htm#TaI>, you
might have been able to write something more appropriate,

--
(c) John Stockton, nr London UK ?@merlyn.demon.co.uk IE8 FF8 Op11 Sf5 Cr15
news:comp.lang.javascript FAQ <http://www.jibbering.com/faq/index.html>.
<http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      02-22-2012
Gene Wirchenko wrote on 22 feb 2012 in comp.lang.javascript:

> On 22 Feb 2012 15:41:57 GMT, "Evertjan."
> <(E-Mail Removed)> wrote:
>
>>Gene Wirchenko wrote on 22 feb 2012 in comp.lang.javascript:

>
> [snip]
>
>>> Well, there is a loop being executed over and over. That is why
>>> my comment about approaching busy wait.

>>
>>You are WRONG in the case of Javascript [yes, we know Thomas] and
>>setTimeout().
>>
>>There is NO wait-loop here, Javascript execution finishes.

>
> I stated that there was a loop, not that there was a wait-loop.


Same thing, you are wrong in thinking that, there is no loop made.

In other worde sthere is no polling to see if the right time has come,
the right time is when the O.S. interupt fires.

There is no Javascript execution till triggered by the operating system,
so there are no CPU-cycles used by the programme.


> [snip]
>
> Sincerely,
>
> Gene Wirchenko
>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
 
Gene Wirchenko
Guest
Posts: n/a
 
      02-22-2012
On 22 Feb 2012 21:55:09 GMT, "Evertjan."
<(E-Mail Removed)> wrote:

>Gene Wirchenko wrote on 22 feb 2012 in comp.lang.javascript:
>
>> On 22 Feb 2012 15:41:57 GMT, "Evertjan."
>> <(E-Mail Removed)> wrote:
>>
>>>Gene Wirchenko wrote on 22 feb 2012 in comp.lang.javascript:

>>
>> [snip]
>>
>>>> Well, there is a loop being executed over and over. That is why
>>>> my comment about approaching busy wait.
>>>
>>>You are WRONG in the case of Javascript [yes, we know Thomas] and
>>>setTimeout().
>>>
>>>There is NO wait-loop here, Javascript execution finishes.

>>
>> I stated that there was a loop, not that there was a wait-loop.

>
>Same thing, you are wrong in thinking that, there is no loop made.


Sure there is. The sequence that sets the timeout is repeatedly
executed.

>In other worde sthere is no polling to see if the right time has come,
>the right time is when the O.S. interupt fires.
>
>There is no Javascript execution till triggered by the operating system,
>so there are no CPU-cycles used by the programme.


I know that. That is what makes it not a busy-wait.

Sincerely,

Gene Wirchenko
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
I know about the shutdown timer, is there a "switch on" timer... Mal Carter Computer Support 3 01-12-2008 01:58 AM
page timer, or redirect timer Simon ASP .Net 1 11-04-2005 07:14 PM
System.Timers.Timer/System.Threading.Timer Not Firing At All on Dev Server james.e.coleman@gmail.com ASP .Net 1 02-22-2005 09:41 PM
System.Timers.Timer vs. System.Threading.Timer Kelsang Wangchuk ASP .Net 0 07-31-2003 04:28 PM



Advertisments