Timers and elapsed time in Java is an interesting topic. Can be a moving target
though...
Some recent articles:
https://hazelcast.com/blog/locksupport-parknanos-under-the-hood-and-the-curious-case-of-parking/
https://hazelcast.com/blog/locksupport-parknanos-under-the-hood-and-the-curious-case-of
The OS' clock resolution is in play here, which depending on your OS will
give you varying results. Also, on Java 9, you get better clock resolution
for certain APIs. Kinda messy...
Gary
On Thu, Jun 6, 2019 at 4:28 PM Erwin Hogeweg
wrote:
> Hi,
>
> I am tad confused about the StopWatch resoluti
Hi,
I am tad confused about the StopWatch resolution. I have a very basic JUnit
test that starts a stopwatch, wait for 10ms and then stops it, and checks the
value. In about 40% of the cases it is less than the 10ms wait time.
Is that expected? What is my blind spot?
Regards,
Erwin
-