Microsoft's Robocopy program has these two options:
/FFT :: assume FAT File Times (2-second granularity).
/DST :: compensate for one-hour DST time differences.
What is the exact algorithm that Robocopy uses for this?
If I wanted to implement this in Python for example, how would I do this? I would like to know specifically how Robocopy does it, and I would like to know if there is a more correct way to compare timestamps while allowing for DST and filesystem differences.
def compare_file_timestamps_robocopy_style(file1, file2):
"""Returns True if the file timestamps should be considered equal when
adjusted for filesystem granularity and daylight savings time.
This uses the same algorithm as Microsoft's Robocopy.
"""
time1 = os.path.getmtime(file1)
time2 = os.path.getmtime(file2)
return ???
A pseudocode answer would be ok too if it is detailed enough.
/DSTflag does, so I can't answer directly. But I do know that FAT and its variants use local-time for timestamps, whereas NTFS and most other modern files systems use UTC-based timestamps. That creates issues often on portable devices such as memory sticks of digital cameras. In the case of ambiguous local time in a DST fall-back, the only way to disambiguate would be through some other piece of data, such as a sequentially generated filename, presuming there are files in both the daylight and standard periods and they are out of sequence. Maybe it's doing that? IDK/DSTwould be implemented such that two files with timestamps exactly one hour apart would be treated as if the timestamps matched. That makes sense to me also - but I cannot find that documented anywhere. It's also hacky as F.