Newbie - Timers and Send

Stephen King st.king42 at ntlworld.com
Mon Dec 8 14:03:17 EST 2003


Paul,

As already suggested, 'Send' is the best way, but beware that it is not in
itself very accurate (typically around 95% I've found). If you need accurate
timing, then you may need to enhance it a little.

I have an app which is used for swim coaching, accuracy required to 0.02
seconds. Send is not accurate enough for this.

The way I got around it was to 'Send' more often than I needed (every 10
mSec in my case), then check the elapsed time between 'Send's against the
system clock to update my timer - Using 'Send' a bit like an interrupt. This
method worked fine, accurate to 0.01 seconds with no noticable overhead on
processing.

Hope this helps,
Cheers
Steve

>Subject: Re: newbie question
>To: How to use Revolution <use-revolution at lists.runrev.com>
>Message-ID: <3FD47B3F.79108D17 at Club-Internet.fr>
>Content-Type: text/plain; charset=us-ascii; x-mac-type="54455854";
>x-mac-creator="4D4F5353"

> how can I keep a timer running and still allow the application to do other
things?
>
> my timer code is just -
>
> put the seconds into Start
>
> repeat forever
>
> wait for 1 sec
>
> put (the seconds - value(Start)) into field "Timer"
>
> end repeat
>
> of course the 'repeat forever'  means nothing else can happen meantime
>
> thanks for any insights



More information about the use-livecode mailing list