Why does the timestamp of a file increase by up to 2 seconds when I copy it to a USB thumb drive?

Raymond Chen

We saw some time ago thatthe FAT file system records timestamps in local timeto only two-second resolution.This means that copying a file to a FAT-formatted device(typically a floppy drive or a USB thumb drive)can increase the timestamp by up two seconds.And even after the file is copied, the timestamp is not stable.The timestamp changes depending on the time zone employedby the computer that accesses the drive.In particular,if you are in a part of the world which changes clocks duringthe summer,then the timestamp on the file moves by an hour every springand then moves in the opposite direction every autumn.(Because you change time zones twice a year.)

Okay, but why does the timestamp always increaseto the nearest two-second interval?Why not round to the nearest two-second interval?That way, the timestamp change is at most one second.

Because rounding to the nearest interval means that the filemight go backward in time,and that creates its own problems.(Causality can be such a drag.)

For example, suppose you regularly back up files from yourNTFS-formatted C: drive to your USB thumb drive mounted as drive F:by typing

xcopy /D C:\Files\* F:\Files\*

If the timestamps rounded to the nearest two-second interval,then half the files on average will have a timestamp on the USBthumb drive older than the files on the C: drive.This means that if you perform the command a second time,approximately half of the files will be copied again.To the user, it looks like the xcopy commandnever finishes the job,because each time you tell it “Perform an incremental backup”it always finds something to copy.It never says, “All files up to date, you can go home now.”

To avoid this infinite loop, the convention is always to round up,so that the copy of a file is never older than the original.