Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] isOutdated() and lastModified()

On Dec 11, 2010, at 16:02, Dmitry Pavlenko wrote:

Hello all,

I seems that FileBasedConfig (and loose-refs-related classes) relies on
java.io.File.lastModified() call (at least in isOutdated() method).

For my Sun Java 1.6.0.22 and OpenJDK 1.6.0 (Debian squeeze/sid)
java.io.File.lastModified() can be the same after changes in the file.

I don't know is it expected, is it JDK bug, or JGit problem. Do you?

The following piece of code outputs

lm1 = 1292082965000
lm2 = 1292082965000
They are equal!

The 000 suggests that the filesystem you are using is storing values to the nearest second rather than the nearest millisecond. So both are being reported as xxx000. If two write operations occur in the same second, on your backing filesystem, then you'll see this same result.

I get this same effect when running on an HFS on OSX.

Alex


Back to the top