Is there an MS document outlining Last Accessed Date RRS feed

  • Question

  • 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!
    Thursday, July 30, 2009 3:32 PM

All replies

  • In short GetFileTime accuracy is 1 day. For more info see..

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

    The import part:

    Last Access Time

    Each file and folder on an NTFS volume contains an attribute called Last Access Time. This attribute shows when the file or folder was last accessed, such as when a user performs a folder listing, adds files to a folder, reads a file, or makes changes to a file. The most up-to-date Last Access Time is always stored in memory and is eventually written to disk within two places:

    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.

    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.


    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.

    • Proposed as answer by Paul Gielens Thursday, July 30, 2009 5:48 PM
    Thursday, July 30, 2009 5:48 PM