Things that go bump in the night:

1) Untimed events present their alarms at midnight, or a bit before,
depending on the alarm preset.

2) The OS wakes up at midnight to do some maintenance on the real time
clock. Some versions of the Dragonball processor have a bug, and the
workaround requires the device to stay fully awake for an entire second. I
don't know which devices are affected by this.

3) On devices with rechargeable batteries, the battery can't be charged
forever, even if the device  is left in the cradle for days. However, once
the battery is fully charged, you don't want still want to "top up" the
battery every once in a while. This topping up is done at midnight. It's as
good a time as any.

4) In the attention manager, all attention items are redrawn at midnight.
This only happens if alarms have gone off and have not been handled by the
user. This is done to give the apps the option of using relative date
terminology (such as "today", or "yesterday") without bothering to set up
their own code to update these at midnight.


On the issue of using the TimGetTicks, as long as the device is on, the tick
clock will be running, and will keep good time. The tick clock is driven off
a timer in the Dragonball. 
The real time clock and the tick clock should stay in perfect
synchronization as long as the device is on. Therefore, it should be
possible to determine how they are related once, and then use this to
determine how many ticks you have to wait for the seconds to advance. This
should continue to work until the device is turned off. This might allow you
to reduce battery drain by avoiding busy waiting. This is just an idea; I
haven't tried it.

If you're willing to write device dependent code (different for each version
of the Dragonball), it's possible to directly read the Dragonball timers.
The result is a very precise timer that runs only when the device is on. It
advances once every 3 CPU cycles on the Pilot, PalmPilot, and Palm III
devices. I haven't tried using it since then, but the timers are probably
set up differently for higher speed CPUs in order to achieve the same 100
ticks per second. This is fun stuff to play with, but don't expect the code
to work on new devices.
-- 
Peter Epstein

-- 
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