Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
927 views
in Technique[技术] by (71.8m points)

.net - Windows-compatible filesystems' file time resolutions

I am trying to write a file synchronization application that would be able to be used universally on different Windows machines using any compatible filesystem. I have a requirement to normalize the timestamps of files before they are synchronized between two machines to a particular granularity so that the files appear to be timestamp-identical on two separate machines after the work of synchronizing is complete. For my purposes, I only need to normalize file timestamps. For each file to be synchronized, I only need to normalize the last write time and the creation time.

MSDN has this to say about the FILETIME structure and its resolution:

Not all file systems can record creation and last access time and not all file systems record them in the same manner. For example, on NT FAT, create time has a resolution of 10 milliseconds, write time has a resolution of 2 seconds, and access time has a resolution of 1 day (really, the access date). On NTFS, access time has a resolution of 1 hour. Therefore, the GetFileTime function may not return the same file time information set using the SetFileTime function. Furthermore, FAT records times on disk in local time. However, NTFS records times on disk in UTC. For more information, see File Times.

According to Wikipedia:

Windows makes use of the FAT, NTFS, exFAT, Live File System and ReFS file systems (the last of these is only supported and usable in Windows Server 2012; Windows cannot boot from it).

So, in other words, my question can be summarized as this:

Among the grouping of FAT, NTFS, exFAT, Live File System and ReFS,

  1. Which one has the worst resolution in Windows for a file's last write time?
  2. Which one has the worst resolution in Windows for a file's creation time?

I have tried searching but cannot find details on the differences in file timestamp resolution between these different Windows-compatible filesystems.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I found my answers here by going to each filesystem's articles and looking up its Date Resolution.

FAT8

Does not record dates and is not supported in Windows.

FAT12, FAT16, FAT16B and FAT32

Some of these are not supported in Windows.

  • Last Modified Time: 2 s
  • Creation Time: 10 ms
  • Access Time: 1 day
  • Deletion Time: 2 s

exFAT

10 ms for all records.

NTFS

100 ns for all records.

Live File System (UDF)

1 μs for all records.

ReFS

Could not find resolution details, but its pretty modern so I'm assuming most of the worst cases are above and that not many people will be using it at the moment. Perhaps someone can spruce this post up when they find out.

So, to answer the questions:

1. Which one has the worst resolution in Windows for a file's last write time?

2 seconds, the FAT filesystem.

2. Which one has the worst resolution in Windows for a file's creation time?

10 ms, also the FAT filesystem.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...