[darcs-users] time stamps

David Roundy droundy at abridgegame.org
Mon Jul 21 15:23:13 UTC 2003


On Mon, Jul 21, 2003 at 07:22:48AM -0700, Zack Brown wrote:
> I see that darcs keeps track of time-stamps on each user's machine, as a way
> of resolving certain tricky merging problems quickly. Larry McVoy and other
> folks have suggested that this is not a robust solution, and that actually,
> the logic required to solve these problems must be a lot more subtle, and
> must completely ignore time-stamp information.
>
> I realize that darcs allows users to turn off the time-stamp dependency,
> but it seems to me that widespread usage of darcs will involve almost
> everyone turning off the time-stamp dependency, in order to avoid the
> problems Larry describes.
>
> Wouldn't it be better to ditch the whole time-stamp thing right off the
> bat, and just go with the more robust solution by default?

The timestamps are not used for merging, but only for diffing.  Darcs keeps
a copy of each file in _darcs/current to be used when running record or
whatsnew to determine which files have changed.  If the timestamps are the
same for ./_darcs/current/file and ./file and the two files have the same
size, then the file is assumed to be unmodified, so it doesn't have to be
read in.  On large repos this can give a *huge* improvement in speed.

Fortunately, this means that darcs never compares timestamps across
machines--although in the case of an nfs-mounted repo you could still run
into clock differences.  But the odds clock skew causing trouble are pretty
small, since darcs only checks for equality of timestamps, so unless by
some chance a machine modifies ./file to have precisely the same timestamp
as the already existing ./_darcs/current/file there is no problem.
Accidental inequality of timestamps is no problem, as the worst it causes
is that the two files be read in and compared with one another.  A more
likely problem is if you modify a file within a second of recording
separate change to the same file--again not a terribly likely scenario, but
the scenario for which the --ignore-times flag is intended.

So in short, I don't believe darcs uses timestamps for any of the evil uses
Larry is worried about.

If you are wondering about the times included in patch names, those are
only for human consumption, and to ensure that the patch names are unique
(unless you make the mistake of recording two different patches with the
same patch name within a second).
-- 
David Roundy
http://www.abridgegame.org




More information about the darcs-users mailing list