[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coldsync-hackers] Setting time
On Tue, 16 Jan 2001, Rich Bowen wrote:
> I'd like to write a NTP (Network Time Protocol) conduit for coldsync, to
> set the clock on my handheld each time I sync. It's my major timepiece,
> since I never wear a watch any more, and every other clock that I use is
> synchronized to the atomic clock.
>
> Can anyone point me in the right direction as to what I need to be doing
> in order to set the clock on the Palm?
There is a DLP function to set the date and time on the Palm
(SetSysDateTime, I believe), so you can use that.
As for how you should proceed, that depends on how you want to do
this.
You can write a standalone program that'll talk to the Palm and
set its time. For this, you can use either the pilot-link library, or
'libpconn' from ColdSync. The ColdSync library is IMO cleaner than
pilot-link, but hasn't been separated into a separate package: you might
need to do moderately ugly things like "cc -I/usr/src/coldsync/include" or
some such.
If you want to help make libpconn independent of ColdSync, you're
more than welcome to do so. Patches will be appreciated.
If you want something that'll set the time each time you sync, and
you use ColdSync (which I assume you are, since you sent your question
here), I suggest that you write a Sync conduit for, say, "Saved
Preferences".
Sync conduits run while the Palm is connected, so you can talk
back and forth to it via SPC (i.e., you can essentially send DLP requests
back and forth over a file descriptor).
The easy way to do this is to just set up a conduit that gets the
local time and sends a SetSysDateTime command to the Palm.
This should be adequate for most uses: the Palm shouldn't be off
by more than a second or so. If you want to get fancy, you can set the
time, then read the time. From this, you can calculate the propagation
delay of the SetSysDateTime request. Take that into account, and send a
new SetSysDateTime command. Repeat until you've attained the desired
precision.
Unfortunately, SPC isn't as well-developed or documented as it
should be. But take a look at conduits/std-categories and
perl/ColdSync/ColdSync/SPC.pm .
--
Andrew Arensburger Actually, these _do_ represent the
arensb@ooblick.com opinions of ooblick.com!
Generic Tagline V 6.01
--
This message was sent through the coldsync-hackers mailing list. To remove
yourself from this mailing list, send a message to majordomo@thedotin.net
with the words "unsubscribe coldsync-hackers" in the message body. For more
information on Coldsync, send mail to coldsync-hackers-owner@thedotin.net.