JDK-8164428 : Release Note: The implementation of the clock returned by system factory methods in java.time.Clock has increased the resolution
  • Type: Sub-task
  • Component: core-libs
  • Sub-Component: java.time
  • Affected Version: 9
  • Priority: P4
  • Status: Closed
  • Resolution: Delivered
  • Submitted: 2016-08-19
  • Updated: 2017-09-22
  • Resolved: 2016-10-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Description
The Java SE 8 specification for `java.time.Clock` states that *''The system factory methods provide clocks based on the best available  system clock. This may use `System.currentTimeMillis()`, or a higher resolution clock if one is available.''* In JDK 8 the implementation of the clock returned was based on `System.currentTimeMillis()`, and thus has only a millisecond resolution. In JDK 9, the implementation is based on the underlying native clock that `System.currentTimeMillis()` is using, providing the maximum resolution available from that clock. On most systems this can be microseconds, or sometimes even tenth of microseconds. 

An application making the assumption that the clock returned by these system factory methods will always have milliseconds precision and actively depends on it, may therefore need to be updated in order to take into account the possibility of a greater resolution, as was stated in the API documentation. It is also worth noting that a new `Clock.tickMillis(zoneId)` method has been added to allow time to be obtained at only millisecond precision - see: [http://download.java.net/java/jdk9/docs/api/java/time/Clock.html#tickMillis-java.time.ZoneId-](http://download.java.net/java/jdk9/docs/api/java/time/Clock.html#tickMillis-java.time.ZoneId-).

Comments
Thanks Stephen - I added that to the release note test.
19-10-2016

Worth noting that Clock.tickMillis(zoneId) has been added to allow time to be obtained at only millisecond precision: http://download.java.net/java/jdk9/docs/api/java/time/Clock.html#tickMillis-java.time.ZoneId-
20-08-2016