加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

.net – 与Windows兼容的文件系统的文件时间分辨率

发布时间:2020-12-13 20:30:11 所属栏目:Windows 来源:网络整理
导读:我正在尝试编写一个文件同步应用程序,该应用程序可以使用任何兼容的文件系统在不同的Windows机器上普遍使用.我需要在将两台计算机之间的文件同步到特定粒度之前规范化文件的时间戳,以便在完成同步工作后,文件在两台独立的计算机上看起来是时间戳相同的.出于
我正在尝试编写一个文件同步应用程序,该应用程序可以使用任何兼容的文件系统在不同的Windows机器上普遍使用.我需要在将两台计算机之间的文件同步到特定粒度之前规范化文件的时间戳,以便在完成同步工作后,文件在两台独立的计算机上看起来是时间戳相同的.出于我的目的,我只需要规范化文件时间戳.对于要同步的每个文件,我只需要规范化上次写入时间和创建时间.

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 07001 function may not return the same file
time information set using the 07002 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).

换句话说,我的问题可归纳为:

在FAT,Live File System和ReFS的分组中,

>对于文件的上次写入时间,哪一个在Windows中具有最差的分辨率?
>对于文件的创建时间,哪一个在Windows中具有最差的分辨率?

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

我通过查看每个文件系统的文章并查找其日期分辨率找到了我的答案 here.

FAT8

不记录日期,Windows不支持.

FAT12,FAT16,FAT16B和FAT32

Windows中不支持其中一些.

>上次修改时间:2秒
>创作时间:10毫秒
>访问时间:1天
>删除时间:2秒

exFAT的

所有记录均为10毫秒.

NTFS

所有记录均为100 ns.

实时文件系统(UDF)

所有记录均为1μs.

裁判

无法找到分辨率细节,但它非常现代,所以我假设大多数最坏的情况都在上面,目前没有多少人会使用它.当他们发现时,也许有人可以修饰这篇文章.

那么,回答问题:

1.对于文件的最后写入时间,哪一个在Windows中具有最差的分辨率?

2秒,FAT文件系统.

2.对于文件的创建时间,哪一个在Windows中具有最差的分辨率?

10毫秒,也是FAT文件系统.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读