是否有MS文档概述了上次访问日期 [英] Is there an MS document outlining Last Accessed Date

查看:76
本文介绍了是否有MS文档概述了上次访问日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们现在正在开展一个项目,我们正在访问给定文件的最后访问日期,但是,由于此日期的行为和不一致,我们正在慢慢疯狂。

例如,在Windows资源管理器中,如果按F5键执行刷新 - 任何文件上次访问日期都会更改!但是如果你右键单击同一个窗格,并选择刷新 - 他们不会改变!非常奇怪。

微软是否制作了一份文件(最好是一份正式的设计文件),概述了最后访问日期的真正基础,它如何变化,虽然听起来很愚蠢,但它们的定义是什么?访问"是什么?

这将是最有帮助的 - 我试图搜索这样一个文件,但在MSDN上找不到任何关闭。

我们的项目依赖于这个奇怪的行为日期字段,很高兴知道它是如何工作的以及它的真正用途。

感谢您的帮助!

We have been working on a project now for some time where we are accessing the Last Accessed Date of given files, however, we are being driven slowly crazy by the behavior and inconsistentcies in this date.

For example, in Windows Explorer if you push the F5 key to do a Refresh - any files Last Accessed Date changes!  But if you right click in the same pane, and select Refresh - they DONT change!!!  Very strange.

Has Microsoft ever produced a document (preferably a formal design document) that outlines what Last Accessed Date is really based on, how it changes, and though it sounds silly, what they define "accessed" as being?

This would be most helpful - I have tried to search for such a document but nothing close can be found on MSDN.

Our project is dependant upon this strangely behaving Date field and it would be nice to know how it really works and what it is truly intended for.

Thanks for any help!

推荐答案

简而言之,GetFileTime的准确度为1天。有关详细信息,请参阅..

本文 http://technet.microsoft.com/en-us/library/cc781134(WS.10).aspx

导入部分:

上次访问时间

NTFS卷上的每个文件和文件夹都包含一个名为"上次访问时间"的属性。此属性显示上次访问文件或文件夹的时间,例如用户执行文件夹列表,将文件添加到文件夹,读取文件或更改文件。 最新的上次访问时间始终存储在内存中,并最终在两个位置写入磁盘

文件的属性,它是其MFT记录的一部分。

The file’s attribute, which is part of its MFT record.

文件的目录条目 。目录条目存储在包含该文件的文件夹中。具有多个硬链接的文件具有多个目录条目。

A directory entry for the file. The directory entry is stored in the folder that contains the file. Files with multiple hard links have multiple directory entries.

磁盘上的上次访问时间并不总是最新的,因为NTFS查找一个小时的间隔在强制将上次访问时间更新到磁盘之前。当用户或程序对文件或文件夹执行只读操作(例如列出文件夹内容或读取(但不更改)文件夹中的文件)时,NTFS还会延迟将上次访问时间写入磁盘。如果上次访问时间在磁盘上保持最新以进行读取操作,则所有读取操作都将成为写入操作,这会影响NTFS性能。

The Last Access Time on disk is not always current because NTFS looks for a one-hour interval before forcing the Last Access Time updates to disk. NTFS also delays writing the Last Access Time to disk when users or programs perform read-only operations on a file or folder, such as listing the folder’s contents or reading (but not changing) a file in the folder. If the Last Access Time is kept current on disk for read operations, all read operations become write operations, which impacts NTFS performance.

注意

即使所有磁盘上的值都不是最新的,上次访问时间的基于文件的查询也是准确的。 NTFS在查询中返回正确的值,因为准确的值存储在内存中。


我希望这能为您解决问题。另请参阅此信息 http://msdn.microsoft.com/en-us/library /ms724290(VS.85).aspx 并向下钻取到GetFileTime( http://msdn.microsoft.com/en-us/library/ms724320(VS.85).aspx )函数给出了最终答案:

并非所有文件系统可以记录创建和上次访问时间,并非所有文件系统都以相同的方式记录它们。例如,在FAT上,创建时间的分辨率为10毫秒,写入时间的分辨率为2秒,访问时间的分辨率为1天(实际上是访问日期)。因此, GetFileTime 函数可能无法使用 SetFileTime 。 NTFS在上次访问后最多延迟一小时延迟更新文件的上次访问时间。

File-based queries of Last Access Time are accurate even if all on-disk values are not current. NTFS returns the correct value on queries because the accurate value is stored in memory.


I hope this clears things up for you. Also see this information http://msdn.microsoft.com/en-us/library/ms724290(VS.85).aspx and drill down to the GetFileTime (http://msdn.microsoft.com/en-us/library/ms724320(VS.85).aspx) function which gives the final answer:

Not all file systems can record creation and last access times and not all file systems record them in the same manner. For example, on 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). Therefore, the GetFileTime function may not return the same file time information set using SetFileTime. NTFS delays updates to the last access time for a file by up to one hour after the last access.


这篇关于是否有MS文档概述了上次访问日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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