JDK-8177809: File.lastModified() is losing milliseconds (always ends in 000)

Ismael Juma mlists at juma.me.uk
Mon Dec 4 15:41:06 UTC 2017


Thanks Alan. I had a look at the core-libs-dev discussion and it seems like
there was a bit of confusion on whether Files.getLastModifiedTime had the
right behaviour or not (Ricardo Almeida briefly mentioned that it did not
work for him in Ubuntu as you said). It might be worth adding a comment to
the JIRA ticket for others who come across it.

Cc'd Brian Burkhalter so he's aware that his fix does work in macOS with
APFS (it had no effect on HFS+ as expected). :)

Ismael

On Mon, Dec 4, 2017 at 2:49 PM, Alan Bateman <Alan.Bateman at oracle.com>
wrote:

> On 04/12/2017 09:22, Ismael Juma wrote:
>
>> Hi all,
>>
>> The following was stated in JDK-8177809:
>>
>> "File.getLastModified() always returns with second precision, loosing the
>> milliseconds (i.e. a number ending in 000). I tried using
>> Files.getLastModifiedTime and it seems to work correctly."
>>
>> It doesn't look like Files.getLastModifiedTime works correctly either (at
>> least in some cases). I tested Java 10 on macOS High Sierra and APFS and
>> File.getLastModified has better behaviour now:
>>
>> Thanks. The changes for JDK-8177809 in JDK 10 need additional changes to
> the NIO implementation. There was a brief discussion on core-libs-dev
> recently about this too.
>
> -Alan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20171204/5c249ea4/attachment.html>


More information about the nio-dev mailing list