gpt4 book ai didi

c# - 为什么复制到U盘时文件修改时间自动增加2秒?

转载 作者:可可西里 更新时间:2023-11-01 14:38:29 27 4
gpt4 key购买 nike

好的,我遇到了一个奇怪的时刻,试图获取 USB 驱动器中文档的文件修改时间。 通常情况下,我认为将文件复制到 USB 驱动器时文件修改时间不会改变。但是,当我将任何文件复制到 U 盘时,我发现文件修改时间增加了两倍。

然而,在研究中,我发现其他人在网上遇到过这个问题,但除了 this article on wikipedia 之外,我还没有看到任何答案。这说明了在 FAT 分区上增加的碎片文件的读写时间,并没有为我澄清事情。

我无法验证是否所有文件都会发生这种情况。但是,我想知道的是关于将文件复制到 USB 驱动器时修改时间究竟发生了什么的任何官方来源。我自己修改代码中的文件修改时间是否可取? 即减去两秒

最佳答案

Time Stamps Change When Copying From NTFS to FAT :

File time stamps on FAT drives are rounded to the nearest two seconds (even number) when the file is written to the drive. The file time stamps on NTFS drives are rounded to the nearest 100 nanoseconds when the file is written to the drive. Consequently, file time stamps on FAT drives always end with an even number of seconds, while file time stamps on NTFS drives can end with either even or odd number of seconds.

When files are copied from NTFS drives to FAT drives, some file time stamp rounding has to occur; the file time stamp is rounded up to the next even second.

关于c# - 为什么复制到U盘时文件修改时间自动增加2秒?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11546839/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com