Skip to content
Permalink
Browse files

TimeSizeCompare.cpp: Fix GitHub issue #132: Files marked as different…

… in "Modified Date" compare mode although modification dates are equal (2)
  • Loading branch information...
sdottaka committed Sep 8, 2019
1 parent 8b56004 commit 68fe93ca42717cbe2dbf003c2c51dcfa3fd0c269
Showing with 67 additions and 70 deletions.
  1. +3 −6 Src/CompareEngines/TimeSizeCompare.cpp
  2. +64 −64 Testing/GoogleTest/TimeSizeCompare/TimeSizeCompare_test.cpp
@@ -51,12 +51,15 @@ int TimeSizeCompare::CompareFiles(int compMethod, int nfiles, const DIFFITEM &di
// Check that we have both filetimes
nTimeDiff = di.diffFileInfo[0].mtime - di.diffFileInfo[1].mtime;
if (nTimeDiff < 0) nTimeDiff *= -1;
nTimeDiff = nTimeDiff / Timestamp::resolution() * Timestamp::resolution();
if (nfiles > 2)
{
nTimeDiff12 = di.diffFileInfo[1].mtime - di.diffFileInfo[2].mtime;
nTimeDiff02 = di.diffFileInfo[0].mtime - di.diffFileInfo[2].mtime;
if (nTimeDiff12 < 0) nTimeDiff12 *= -1;
if (nTimeDiff02 < 0) nTimeDiff02 *= -1;
nTimeDiff12 = nTimeDiff12 / Timestamp::resolution() * Timestamp::resolution();
nTimeDiff02 = nTimeDiff02 / Timestamp::resolution() * Timestamp::resolution();
}
if (m_ignoreSmallDiff)
{
@@ -66,12 +69,6 @@ int TimeSizeCompare::CompareFiles(int compMethod, int nfiles, const DIFFITEM &di
nTimeDiff12 -= SmallTimeDiff * Timestamp::resolution();
nTimeDiff02 -= SmallTimeDiff * Timestamp::resolution();
}
else
{
nTimeDiff -= Timestamp::resolution();
nTimeDiff12 -= Timestamp::resolution();
nTimeDiff02 -= Timestamp::resolution();
}
if (nTimeDiff <= 0 && nTimeDiff12 <= 0)
code = DIFFCODE::SAME;
else

0 comments on commit 68fe93c

Please sign in to comment.
You can’t perform that action at this time.