realbasic-nug
[Top] [All Lists]

Re: Two timers on same window

To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Two timers on same window
From: William Squires <wsquires at satx dot rr dot com>
Date: Sat, 31 Mar 2007 21:03:48 -0500
Delivered-to: listarchive at realsoftware dot com
Delivered-to: realbasic-nug at lists dot realsoftware dot com
References: <460D70FE dot 8050902 at asburyroad dot com>
   There's nothing to prevent you from using two (or more) timers on  
a window. Just keep in mind that timers YIELD time, they don't  
measure it. The more processor resources you use up (i.e. by not  
releasing time back to the OS's event loop - and that includes the  
processing time taken to execute the timer's Action() event!), the  
more likely it is that your timers will fire later than you think, so  
if time accuracy is important, you may want to use a thread, or  
decrease the period of the timers and check the actual system clock  
(somehow) more often.

On Mar 30, 2007, at 3:20 PM, Jayson Garrett wrote:

> Hey folks,
>
> First, thanks for all the information last week about creating a  
> custom
> timer. I left for a day or so after I asked that question, and didn't
> get to properly thank everyone that answered.
>
> My next question is about plain ordinary vanilla timers.
>
> Would having two timers that each timed different things on one window
> be a Bad Thing (TM)?
>
> In the interests of keeping the complexity of the code in the Action
> events as simple as possible, I've thought of of breaking it up  
> into two
> separate timers.
> _______________________________________________
> Unsubscribe or switch delivery mode:
> <http://www.realsoftware.com/support/listmanager/>
>
> Search the archives:
> <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


From  Sat 31 Mar 2007 20:26:42 -0600
Return-Path: <realbasic-nug-bounces at lists dot realsoftware dot com>
X-Original-To: listarchive at realsoftware dot com
Delivered-To: listarchive at realsoftware dot com
Received: by xmail.realsoftware.com (Postfix, from userid 1037)
        id E9EC31DB6DC9; Sat, 31 Mar 2007 19:26:51 -0700 (PDT)
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on 
        www.realsoftware.com
X-Spam-Level: 
X-Spam-Status: No, score=-2.8 required=4.5 tests=ALL_TRUSTED,AWL,BAYES_00,
        NO_REAL_NAME autolearn=ham version=3.1.1
Received: from lists.realsoftware.com (m.realsoftware.com [66.116.103.65])
        by xmail.realsoftware.com (Postfix) with ESMTP id E29001DB6DBE;
        Sat, 31 Mar 2007 19:26:50 -0700 (PDT)
Received: from real-software-mini.local (localhost [127.0.0.1])
        by lists.realsoftware.com (Postfix) with ESMTP id CB66A1A9A18;
        Sat, 31 Mar 2007 21:26:46 -0500 (CDT)
X-Original-To: realbasic-nug at lists dot realsoftware dot com
Delivered-To: realbasic-nug at lists dot realsoftware dot com
Received: from mail.verex.com (mail.verex.com [66.116.103.197])
        by lists.realsoftware.com (Postfix) with ESMTP id 87C121A9A0D
        for <realbasic-nug at lists dot realsoftware dot com>;
        Sat, 31 Mar 2007 21:26:42 -0500 (CDT)
Received: from [66.116.103.197] (localhost [127.0.0.1])
        by mail.verex.com (Postfix) with SMTP id A797B7259CA
        for <realbasic-nug at lists dot realsoftware dot com>;
        Sat, 31 Mar 2007 20:26:42 -0600 (MDT)
Date: Sat, 31 Mar 2007 20:26:42 -0600
Subject: Re: Two timers on same window
From: joe at strout dot net
To: realbasic-nug at lists dot realsoftware dot com
In-Reply-To: <9588FCC0-A8DE-46B6-B179-C3137356D43F at satx dot rr dot com>
X-Mailer: VerEx Email Gateway
Message-Id: <20070401022642 dot A797B7259CA at mail dot verex dot com>
X-BeenThere: realbasic-nug at lists dot realsoftware dot com
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: realbasic-nug-bounces at lists dot realsoftware dot com
Errors-To: realbasic-nug-bounces at lists dot realsoftware dot com

On Apr 01, 2007, at 02:03 UTC, William Squires wrote:

> There's nothing to prevent you from using two (or more) timers on 
> a window. Just keep in mind that timers YIELD time, they don't  
> measure it. The more processor resources you use up (i.e. by not  
> releasing time back to the OS's event loop - and that includes the  
> processing time taken to execute the timer's Action() event!), the  
> more likely it is that your timers will fire later than you think, so
> if time accuracy is important, you may want to use a thread, or  
> decrease the period of the timers and check the actual system clock  
> (somehow) more often.

This is a fair point, but note that decreasing the period of the timers
will probably not help accuracy.  A timer actually does watch the
system clock; it's scheduled to fire at the correct time relative to
whenever it fired last, and it'll do so unless your main thread is tied
up doing something else at the time.  And when that's the case, it'll
fire as soon as your main thread finishes whatever it's doing and
returns to the event loop.  So as you can see, a shorter period doesn't
make it any more accurate.

Best,
- Joe

--
Joe Strout -- joe at strout dot net
Verified Express, LLC     "Making the Internet a Better Place"
http://www.verex.com/

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>