What does it mean when you have two identical files with identical time stamps, yet Windows says that one file is newer than the other one? How can that be? Today’s SuperUser Q&A post helps a confused reader solve a time stamp mystery.
Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.
SuperUser reader WBT wants to know how Windows decides which of two files with identical time stamps is newer:
When Windows displays a dialog like this with matching time stamps, how does it determine which of the two files is newer?
At first, I thought Windows was comparing the date created attribute and using the result of that comparison to label one or the other as newer. If a file was copied into a particular location, it may have the creation date of when the copy was made rather than the creation date of the original file. However, after reproducing it with another file, the result of which one is newer seems to be the opposite:
The result is the same whether copying or moving the file:
And for background, the file in test2 is a previously made copy of the file in test1.
How does Windows decide which of two files with identical time stamps is newer?
SuperUser contributor grawity has the answer for us:
Time stamps in the NTFS file system have a resolution of 100 nanoseconds (0.0000001 s). Even if the properties dialog shows the same rounded value, it could still be that the files were created within tenths of a second of each other.
Note: Most file systems measure times in μs or ns. FAT32 is a bit of a relic and rounds timestamps to two seconds.
Try one of the following methods to compare the full time stamps:
- wmic datafile where name=”c:\foo\bar.txt” get lastmodified
- (Get-ChildItem c:foobar.txt).LastWriteTime.ToString(“o”)
Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.
Image Credit: WBT (SuperUser)