8231174: (fs) FileTime should have 100ns resolution (win)
Brian Burkhalter
brian.burkhalter at oracle.com
Fri Sep 20 22:16:27 UTC 2019
> On Sep 20, 2019, at 12:44 PM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>
> On 20/09/2019 19:40, Brian Burkhalter wrote:
>> https://bugs.openjdk.java.net/browse/JDK-8231174 <https://bugs.openjdk.java.net/browse/JDK-8231174>
>> http://cr.openjdk.java.net/~bpb/8231174/webrev.00/ <http://cr.openjdk.java.net/~bpb/8231174/webrev.00/>
>>
>> Change the file timestamp resolution on Windows from microseconds to intervals of 100 nanoseconds. Only systems where the working directory is NTFS are currently verified by the test.
>>
> This changes the implementation to use BigInteger in the conversion from long <--> FileTime which seems a bit overkill. I think we should explore other alternatives before going that route.
I’ve eliminated the use of BigInteger in this patch: http://cr.openjdk.java.net/~bpb/8231174/webrev.01/.
I verified that
toWindowsTime(FileTime.from(Long.MAX_VALUE, TimeUnit.NANOSECONDS))
does not overflow and that
toFileTime(toWindowsTime(FileTime.from(Long.MAX_VALUE, TimeUnit.NANOSECONDS)))
does not overflow and returns 100*(Long.MAX_VALUE/100) as one would expect. The value Long.MAX_VALUE nanoseconds represents about 292 years.
Thanks,
Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190920/01410e90/attachment.html>
More information about the nio-dev
mailing list