Peter Epstein writes:
>but I think all you need to do is pass a suitable constant for the
>timeout value in your call to EvtGetEvent rather than evtWaitForever.
>A typical value for this would be a one second interval.

A constant won't work!  EvtGetEvent may return around or before
the given amount of ticks has passed.  Instead of a constant you want
to use the difference between (the tickcount of the last update plus
one second) and the current tickcount as your event timeout parameter.
Then you want to check at each event to see if enough ticks has passed
for another timer or clock update.  If not, reset the timeout value
per the above and wait for another event.

In order to account for the time it take to do the actual update,
instead of using (the tickcount of the last update + 1 second) you may
actually want to use the (tickcount of the when your timer started) plus
(n+1) * (SysGetTimerTicksPerSecond()), where n is the current number
of seconds your timer has already been running.  Otherwise you may
get some drift in the update rate.


Ron Nicholson
HotPaw
http://www.hotpaw.com/rhn/hotpaw/


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

Reply via email to