#1183 Add option to ignore less than 3 seconds time difference

Trunk
closed-accepted
Kimmo Varis
5
2005-04-24
2005-04-14
Kimmo Varis
No
0 up votes | 0 down votes | 0%
8 comments

RFE #1172563 ignore Timestamps within specific Timeframe
https://sourceforge.net/tracker/index.php?func=detail&aid=1172563&group_id=13216&atid=363216

For some reason Windows gets timestamps off by one
second in some cases. I can trivially reproduce this
when saving files to network share. This causes
problems with our current compare by date comparemethod
since files with one second difference are shown as
different. Even though they really are same file, saved
at exactly same time.

So this patch adds new checkbox option to Compare options:
"Ignore time difference less than 3 seconds". That
checkbox is only enabled when compare by date is
selected as compare method.

Discussion

  • Kimmo Varis
    Kimmo Varis
    2005-04-14

    Original and altered files

     
  • Jochen Tucht
    Jochen Tucht
    2005-04-15

    Logged In: YES
    user_id=766060

    How can you save two files at exactly same time?

    I guess the difference between creation timestamps will
    reflect the time it takes to save the first file, and the difference
    between last write timestamps will reflect the time it takes to
    save the second file. And saving a large file over network may
    well take longer than 3 seconds.

    Proposal:
    1. Save left file
    2. Save right file
    3. GetFileTime(hFileRight, ...)
    4. SetFileTime(hFileLeft, ...)

     
  • Jochen Tucht
    Jochen Tucht
    2005-04-16

    Logged In: YES
    user_id=766060

    Timestamps should of course only be synchronized if merge
    session actually yields identical files.

     
  • Kimmo Varis
    Kimmo Varis
    2005-04-16

    Logged In: YES
    user_id=631874

    Sorry, my description was a bit vague, I didn't have much
    time to submit this..

    > How can you save two files at exactly same time?
    Yes, I didn't mean saving from WinMerge. Propably I cannot
    with WinMerge.

    What happens for me (what I was describing in referenced RFE
    item too) is file timestamps get somehow modified or rounded
    when saved to network share. Can't say if it happens when
    copying files from local disk to network.

    But I see this happen lots of times every day at work:
    1) I open file for editing (we use ultraedit editor) from
    network share
    2) I do some editing to file, and save it (to network share)
    3) Ultraedit shows messagebox that the file (I just saved)
    is changed, and asks if I want to re-load it. It gets really
    annoying.

    I know some apps have this kind of option I'm suggesting
    (Ignore one-two second differences in timestamps). And I
    really hoped ultraedit had it too.

    I'm not sure why it happens. My guess is ultraedit stores
    time file is saved and then compares to timestamp of file
    saved. And for some reason there is that one second (?)
    difference.

     
  • Jochen Tucht
    Jochen Tucht
    2005-04-19

    Logged In: YES
    user_id=766060

    > Filetime has two seconds resolution.

    That applies to (NT)FAT, and is probably a hangover from
    DOS days. NTFS is more accurate.

     
  • Kimmo Varis
    Kimmo Varis
    2005-04-22

    Logged In: YES
    user_id=631874

    Happened for me couple of hours ago: I created new
    scratchpads, typed some text and saved that. Then when I
    rescanned that just saved file, WinMerge told me file is
    changed since last save. It wasn't, not in WinMerge or in
    disk. And disk I was saving to was FAT.

    So this is real problem that can happen now and then.

    I'll apply this patch in couple of days,

     
  • Kimmo Varis
    Kimmo Varis
    2005-04-24

    Logged In: YES
    user_id=631874

    I moved option to 'System' page and made it affect to
    mergedoc's file changed check too (which caused my problem
    described below).

    Applied to CVS trunk (2.3). Closing.

    Checking in PreferencesDlg.cpp;
    /cvsroot/winmerge/WinMerge/Src/Common/PreferencesDlg.cpp,v
    <-- PreferencesDlg.cpp
    new revision: 1.3; previous revision: 1.2
    done
    Checking in DiffContext.cpp;
    /cvsroot/winmerge/WinMerge/Src/DiffContext.cpp,v <--
    DiffContext.cpp
    new revision: 1.48; previous revision: 1.47
    done
    Checking in DiffContext.h;
    /cvsroot/winmerge/WinMerge/Src/DiffContext.h,v <--
    DiffContext.h
    new revision: 1.47; previous revision: 1.46
    done
    Checking in DirDoc.cpp;
    /cvsroot/winmerge/WinMerge/Src/DirDoc.cpp,v <-- DirDoc.cpp
    new revision: 1.112; previous revision: 1.111
    done
    Checking in DirScan.cpp;
    /cvsroot/winmerge/WinMerge/Src/DirScan.cpp,v <-- DirScan.cpp
    new revision: 1.46; previous revision: 1.45
    done
    Checking in MainFrm.cpp;
    /cvsroot/winmerge/WinMerge/Src/MainFrm.cpp,v <-- MainFrm.cpp
    new revision: 1.258; previous revision: 1.257
    done
    Checking in Merge.rc;
    /cvsroot/winmerge/WinMerge/Src/Merge.rc,v <-- Merge.rc
    new revision: 1.289; previous revision: 1.288
    done
    Checking in OptionsDef.h;
    /cvsroot/winmerge/WinMerge/Src/OptionsDef.h,v <-- OptionsDef.h
    new revision: 1.29; previous revision: 1.28
    done
    Checking in PropRegistry.cpp;
    /cvsroot/winmerge/WinMerge/Src/PropRegistry.cpp,v <--
    PropRegistry.cpp
    new revision: 1.13; previous revision: 1.12
    done
    Checking in PropRegistry.h;
    /cvsroot/winmerge/WinMerge/Src/PropRegistry.h,v <--
    PropRegistry.h
    new revision: 1.13; previous revision: 1.12
    done
    Checking in readme.txt;
    /cvsroot/winmerge/WinMerge/Src/readme.txt,v <-- readme.txt
    new revision: 1.1593; previous revision: 1.1592
    done
    Checking in resource.h;
    /cvsroot/winmerge/WinMerge/Src/resource.h,v <-- resource.h
    new revision: 1.174; previous revision: 1.173
    done
    Checking in StdAfx.h;
    /cvsroot/winmerge/WinMerge/Src/StdAfx.h,v <-- StdAfx.h
    new revision: 1.16; previous revision: 1.15
    done

     
  • Kimmo Varis
    Kimmo Varis
    2005-04-24

    • labels: --> File handling
    • assigned_to: nobody --> kimmov
    • status: open --> closed-accepted