How to return millisecond information for File Access on Mac Os X (in Java)?

笑着哭i 提交于 2020-01-21 11:27:06

问题


I just recognized that Mac Os X does not return any millisecond information to java.io.File#lastModified() method.

The long values are rounded, so the most specific kind of information is the second after transfer to a DateTime Object.

Is there a way to get those information some other way, maybe through the java.nio.file.Files#readAttributes(Path,Class,LinkOption[]) method, or want it be possible to distinguish between milliseconds?


回答1:


This is a limitation of the file system, not of the Java API. According to the format specification HFS+ only stores timestamps to a granularity of one second.



来源:https://stackoverflow.com/questions/18403588/how-to-return-millisecond-information-for-file-access-on-mac-os-x-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!