views:

342

answers:

4
A: 

Hmm, possibly this from MSDN:

When first called, FileSystemInfo calls Refresh and returns the cached information on APIs to get attributes and so on. On subsequent calls, you must call Refresh to get the latest copy of the information.

But you are seeing the LAT always being a few minutes in the [future|past]?

cfeduke
A: 

The MSDN article with basic info about file times has this to say about file time resolution and Last Access times:

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). NTFS delays updates to the last access time for a file by up to one hour after the last access.

This would imply that on both FAT and NTFS, the Last Write Time will generally not be very precise, although I'm not sure the exact values they quote are correct.

Charlie
+1  A: 

In my experience, last access time is notoriously unreliable. According to http://technet.microsoft.com/en-us/library/cc781134.aspx ...

"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."

Apparently, the in memory copy will be correct, but in my experience, you may get a cached value which may be out of date. Also, note that last access time may be turned off by the user, and is turned off by default in Vista and 2008.

Brent Rockwood
A: 

thank you all!

Michael G