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

Kristina Brooks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 25 12:36:36 PST 2018


kristina added a comment.

In D54826#1307402 <https://reviews.llvm.org/D54826#1307402>, @aaron.ballman wrote:

> In D54826#1307383 <https://reviews.llvm.org/D54826#1307383>, @akyrtzi wrote:
>
> > > The general changes to the support libraries are usually facilitated because of missing functionality that is required somewhere else and it being the most logical place to add it. If so please attach related revisions to this one (through "Edit Related Revisions") so it's more clear why this was added
> >
> > There have been enhancements to file_status that added more info without the requirement you stated (attach related revisions to this one), like:
> >  https://reviews.llvm.org/D31110
> >  https://reviews.llvm.org/D18456
> >
> > This patch makes no changes to the existing API so there's no specific place that I can point to, but it improves accuracy of *every* site that calls getLastModification() and uses its value for comparisons, in and out-of-tree. It addresses 'false-negatives' (mistakenly considering that the mod time did not change because the change happened within 1 second) and 'false-positives' (when considering same mod time as 'changed' so as to be conservative against sub-second changes).
>
>
> 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.


Unfortunately there isn't a lot that can be done about that short of keeping a separate index of files and their timestamps, which seems to be slightly overkill, it's unlikely to affect anything unless you have a setup with different filesystems and are crossing mountpoints but I don't think this is significant enough to consider here. And with regards to NTFS, there really isn't much to be done unless you want to settle on microsecond precision instead as some sort of a universal thing, but that won't cover everything since there are just too many platforms and filesystems to consider besides NTFS, HFS+, APFS and Ext4, there are many others including some using network mounts or ramdisks.


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

https://reviews.llvm.org/D54826





More information about the llvm-commits mailing list