[ccache] PATCH: Look at include files' mtimes

Martin Pool mbp at sourcefrog.net
Tue May 22 17:54:35 MDT 2012

On 22 May 2012 12:00, Justin Lebar <justin.lebar at gmail.com> wrote:
>> I've been burned by mtime only checking before as
>> (excluding some recent file systems) mtime has a resolution
>> only down to one second.
> I tried to address this in the patch, although come to think of it, I
> did it wrong.
> The trick is only to *cache* mtimes that are at least one second older
> than now.  Then the resolution of the clock isn't a problem.

Better to do 2 seconds, since FAT (and maybe some other Windows
related setups) has only a 2-second resolution.

The other thing you can do is, on Unix, use the latest of ctime and
mtime, which should catch cases where the mtime gets reset.

> But if the system clock is set back (e.g. by NTP), we're in trouble.

That's true, but it's a pretty bad idea to make large time steps on a
build machine...

> And hardlinks are often created without bumping the inode's mtime,
> which is also problematic.  (It's problematic for make, too.)

ctime will catch that.

More information about the ccache mailing list