JVM | Platform | Status |
---|---|---|
OpenJDK (Temurin) Current | Linux | |
OpenJDK (Temurin) LTS | Linux | |
OpenJDK (Temurin) Current | Windows | |
OpenJDK (Temurin) LTS | Windows |
A high-resolutiom timer JVM bug workaround.
- Enables high-resolution timers in the JVM.
- OSGi-ready
- JPMS-ready
- ISC license.
The com.io7m.timehack6435126
package implements the workaround for the
comedy of errors described by JDK-6435126
.
- Oracle introduce a JVM option ForceTimeHighResolution intended to force Windows based operating systems into using a high resolution timer instead of the usual low precision one.
- Due to a mistake in the implementation, the ForceTimeHighResolution option actually ends up forcing the OS not to use the high resolution timer.
- Years pass, and someone files a bug on the broken behaviour.
- An anonymous developer at the company states that the behaviour has been broken for years, nobody has complained, and reasons that this means that users that are specifically asking for high resolution timers are satisfied with instead receiving low resolution timers.
- Someone suggests a workaround that can be used at run-time to enable the high resolution timer.
- Years pass.
- An anonymous developer at the company states that the behaviour has been broken for so long, that there's no reason to fix it now.
- The bug is rejected as "WONTFIX".
Call TimeHack6435126.enableHighResolutionTimer()
in your program's main
function prior to doing anything else.
All timer-related functions in the JVM will be significantly more precise from that point onwards.