Windows兼容的文件系统的文件时间分辨率 [英] Windows-compatible filesystems' file time resolutions

查看:215
本文介绍了Windows兼容的文件系统的文件时间分辨率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编写一个文件同步应用程序,可以在不同的Windows机器上使用任何兼容的文件系统。我有一个要求,规范文件的时间戳之前,两台机器之间的同步到一个特定的粒度,以便在同步工作完成后,两个独立的机器上的文件似乎是时间戳相同的。对于我的目的,我只需要规范化文件时间戳。对于每个要同步的文件,我只需要规范化最后的写入时间和创建时间。


$ b

MSDN有关FILETIME结构及其解析的说明

b
$ b


并非所有文件系统都能记录创建和上次访问时间,而不是所有文件系统都以相同的方式记录它们。例如,在NT
FAT上,创建时间的分辨率为10毫秒,写入时间为2秒的
分辨率,访问时间的分辨率为1天
(实际上,访问日期)。在NTFS上,访问时间的分辨率为1
小时。因此, GetFileTime 函数可能不会返回使用的时间信息。 aspxrel =nofollow> SetFileTime 函数。此外,FAT
在本地时间在磁盘上记录时间。但是,NTFS记录在UTC
磁盘上的时间。有关更多信息,请参阅文件时间。





Windows使用FAT,NTFS,exFAT,Live文件系统和ReFS
文件系统(其中最后一个只支持和使用
Windows Server 2012; Windows不能从它启动)。

$ b换句话说,我的问题可以概括为:

在FAT,NTFS,exFAT ,Live File System和ReFS,


  1. 在Windows中,哪一个文件的最后写入时间 b
    $ b

    我已经尝试过搜索,但无法找到这些differen之间文件时间戳分辨率差异的详细信息t Windows兼容的文件系统。

    解决方案

    我找到了我的答案这里,转到每个文件系统的文章并查找它的日期分辨率

    FAT8



    不记录日期,在Windows中不受支持。强大的> FAT12,FAT16,FAT16B和FAT32



    其中一些在Windows中不受支持。



    <

  2. 上次修改时间:2秒

  3. 创建时间:10毫秒 >
  4. 删除时间:2秒

    $ b exFAT



    10 ms所有记录。

    NTFS



    所有记录都是100 ns。
    $ b

    实时文件系统(UDF)

    <所有记录的p> 1μs。


    ReFS



    无法找到解析细节,但它非常现代,所以我假设大多数最糟糕的情况都在上面,目前没有多少人会使用它。也许有人可以在发现这些信息时加以修改。

    因此,回答这些问题:

    强> 1。哪一个在Windows中最差的分辨率是文件的最后写入时间?

    2秒,是FAT文件系统。



    <2> 2。哪一个文件的创建时间在Windows中的分辨率最差?



    <10 ms,也是FAT文件系统。


    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.

    解决方案

    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.

    这篇关于Windows兼容的文件系统的文件时间分辨率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆