Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 728
Alexandru Avatar asked Jul 20 '15 15:07

Alexandru


People also ask

How does the file system record file time?

The system records file times when applications create, access, and write to files. The NTFS file system stores time values in UTC format, so they are not affected by changes in time zone or daylight saving time. The FAT file system stores time values based on the local time of the computer.

What are file systems and why would you need to know?

Why would you need to know? There are many operating systems (like Windows, Mac OS X and Linux) that use different ‘file systems’ that organise programs and the storage of data. Each operating system has limits to what it can read and write to, in terms of compatibility.

What are the different file systems supported by Windows?

The following tables list functionality and feature support comparisons for the four main Windows file systems, NTFS, exFAT, UDF, and FAT32: Windows Server 2003 and Windows XP: The NTFS last access time stamp field is updated. Note The directory-level disk space quotas feature on NTFS is available through the File Server Resource Manager.

Which file system drivers support extended attributes for file systems?

The OS/2 and Windows NT filesystem drivers for FAT12 and FAT16 support extended attributes (using a "EA DATA. SF" pseudo-file to reserve the clusters allocated to them). Other filesystem drivers for other operating systems do not. ^ The f-node contains a field for a user identifier.


1 Answers

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.

like image 54
Alexandru Avatar answered Oct 12 '22 23:10

Alexandru