Follow us on Twitter

How Does Windows Decide Which of Two Files With Identical Time Stamps Is Newer?


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.

The Question

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?

The Answer

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

Via PowerShell:

  • (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)

Akemi Iwaya is a devoted Mozilla Firefox user who enjoys working with multiple browsers and occasionally dabbling with Linux. She also loves reading fantasy and sci-fi stories as well as playing “old school” role-playing games. You can visit her on Twitter and .


How to Set Up Minecraft So Your Kids Can Play Online with Friends
How to Quiet Your Mechanical Keyboard with Switch Dampeners

Comments

comments