8181493: (fs) Files.readAttributes(path, BasicFileAttributes.class) should preserve nano second time stamps
Alan Bateman
Alan.Bateman at oracle.com
Thu Jul 18 14:08:22 UTC 2019
On 10/07/2019 21:39, Brian Burkhalter wrote:
> https://bugs.openjdk.java.net/browse/JDK-8181493
> http://cr.openjdk.java.net/~bpb/8181493/webrev.00/
>
> This patch would change:
>
> 1) UnixFileAttributeViews.setTimes() to set the access and
> modification times of a file or directory with nanosecond precision if
> the system call futimens() [1] is available, and
> 2) UnixFileAttributes to initialize the creation, last access, and
> last modifications FileTimes with nanosecond precision.
>
> New methods to support setting the nanosecond resolution access and
> modification times using futimens() are added to UnixNativeDispatcher.
> Note that unlike futimes() and lutimes(), futimens() is *not*
> guaranteed to be present for the _ALLBDS_SOURCE case and so it is
> looked up using dlsym().
The implementation changes mostly look okay, just wondering if
toFileTime should be simplified for the NS case to use
FileTime.from(Instant.ofEpochSecond(sec, nsec)). Maybe you've tried this
already and are using the Math methods to avoid object allocation?
Can the test using its working directory instead of tmpfs and
deleteOnExit. Tests for timestamps on files can take effort to be
reliable so it would be useful to not delete the crumbs.
-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190718/25d4b040/attachment.html>
More information about the nio-dev
mailing list