Hi Sruthi,

I'm going to assume that you want to call this function while your app is
running.

Your main app event loop should look something like

#define FUNCTION_INTERVAL_MS 250L

void AppEventLoop(void)
{
   UInt32    nextFunctionTick;
   Int32     evtTimeOut;
   UInt32 nowTick;
   UInt32 functionTickInterval;
   EventType event;

   functionTickInterval = (FUNCTION_INTERVAL_MS * SysTicksPerSecond ()) /
1000L;

   nextFunctionTick = TimGetTicks() + functionTickInterval;

   evtTimeOut = 10; /* put a reasonable value here, say half of any regular
event */

   do
   {
      EvtGetEvent(&event, evtTimeOut);

      nowTick = TimGetTicks();

      if (nowTick >= nextFunctionTick)
      {
         function(); /* your function call here */
         nextFunctionTick += functionTickInterval;
      }
      if (! SysHandleEvent(&event))
         if (! MenuHandleEvent(0, &event, &error))
            if (! appHandleEvent(&event)) FrmDispatchEvent(&event);
   }
   while(event.eType != appStopEvent);
}


On 11/02/07, Sruthi <[EMAIL PROTECTED]> wrote:
>
>  Hi Pinus..
>               We are new to this platform so have little knowledge
> regarding this. We are trying to call a function at repeated time intervals
> in milliseconds.
>
>
>
> Pinus Alba wrote:
>
> Hi Sruthi,
>
> I don't know anything about brew so do not know how brew uses timers.
>
> What are you trying to achieve?
>
> e.g.
>
> 1. time how long a function took to execute?
> 2. time when a function started?
> 3. start a function at a specific time?
> 4. start a function at repeated time intervals, e.g. every day, every
> minute?
>
> If we understand what you want to achieve it is easier for us to give a
> useful answer (or say it can't be done).
>
> Regards,
>
>

-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to