[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [coldsync-hackers] Installing newer database from .palm/install
On Wed, Feb 21, 2001 at 05:31:20PM +0100, Mikael Hedin wrote:
> On second thought (when playing with an implementation), it seems
> complicated to make a generic decision for when to overwrite based on
> mtime/ctime. Simplest to stick with the modnum only.
True, but the point was that this is a sucky situation
overall. There probably isn't any good answer.
> Or maybe:
>
> if (newfile->mtime laterthan oldfile->mtime) ||
> ((newfile->mtime == oldfile->mtime) && (newfile->modnum > oldfile->modnum))
> {install newfile}
>
> or should it be the ctimes that are compared?
I think that comparing the mtimes might be misleading. Both
the modnum and mtime can change on both the Palm and on the desktop,
so depending on exactly when you compare them, you might get different
(and wrong) results.
For example, let's say that I modify the database on my Palm
every five minutes, so the database on my Palm has a very high modnum,
and a very recent mtime. On the desktop, the sysadmin has updated
/usr/local/palm/install/SomeDB.pdb six hours ago: it has a mtime of
six hours ago (more recent than the previous version, but more ancient
than the version on my Palm), and a low modnum. Using the above
algorithm, the version on my Palm won't be overwritten, even though it
should be.
If you replace "mtime" with "ctime" in your pseudocode above,
I think the result is quite sensible. When you modify a database on
the Palm, you don't change its ctime, only its mtime. And the modnum
only goes up.
So in the example I gave above,
/usr/local/palm/install/SomeDB.pdb will have a later ctime than the
version on my Palm, so it'll get uploaded.
This does mean that the sysadmin can't just modify the file if
he wants to force an update: he has to create a new database with a
new ctime (or maybe there should be a PDB equivalent of 'touch'). But
at least it's possible to force an update.
> BTW, is there a function to compare struct dlp_time and udword? (For
> the laterthan operator).
No, there isn't, though something can be written, based on
mktime().
--
Andrew Arensburger This message *does* represent the
arensb@ooblick.com views of ooblick.com
Inner-city Trantorian.
--
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.