[PATCH] D54826: [Support/FileSystem] Add sub-second precision for atime/mtime of sys::fs::file_status on unix platforms

Aaron Ballman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 25 12:36:58 PST 2018


aaron.ballman added a comment.

In D54826#1307407 <https://reviews.llvm.org/D54826#1307407>, @akyrtzi wrote:

> In D54826#1307402 <https://reviews.llvm.org/D54826#1307402>, @aaron.ballman wrote:
>
> > Is it going to be an issue that the Windows side of things has a more wild idea of file timestamp resolution? NTFS has a theoretical max precision of 100ns intervals, though according to MSDN, the access time on NTFS has a resolution of 1 hour, which is better than FAT file systems, where the resolution is 1 day. It seems odd to rely on ns resolution for access time, as that seems like it's going to be highly platform and filesystem dependent.
>
>
> I can't speak for the Windows side of things but what you are pointing out is a general question about applications taking into account that file properties may differ across platforms. This is orthogonal to `file_status` itself reporting file properties accurately.


It is and it isn't. This is a cross-platform API and users may expect the values to be somewhat similarly reported across platforms, especially given that there is no documentation on `getLastAccessedTime()` or `getLastModificationTime()`.

> If current `file_status` has 1 hour resolution on NTFS for access time, this patch is not going to make it any better or worse, nor affect behavior of applications that are querying files from NTFS.

Agreed, and I wasn't suggesting that it would. I was more wondering whether you had thoughts on people using this across platforms where they will get very different behavior from the same API. Personally, I think it's reasonable to report the values with whatever precision we have available to us. I think that should be documented on the public API part with a mention that the resolution is expected to differ depending on the file system and OS. WDYT?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54826/new/

https://reviews.llvm.org/D54826





More information about the llvm-commits mailing list