Is System.nanoTime() consistent across threads?
Posted
by obvio171
on Stack Overflow
See other posts from Stack Overflow
or by obvio171
Published on 2010-04-22T03:43:37Z
Indexed on
2010/04/22
3:53 UTC
Read the original article
Hit count: 266
I want to count the time elapsed between two events in nanoseconds. To do that, I can use System.nanoTime()
as mentioned here. The problem is that the two events are happening in different threads.
Since nanoTime()
doesn't return an absolute timestamp but instead can only be used to calculate time differences, I'd like to know if the values I get on the two different threads are consistent with the physical time elapsed between the two events.
© Stack Overflow or respective owner