How can I measure time with microsecond precision in Java?

前端 未结 12 904
死守一世寂寞
死守一世寂寞 2020-12-03 01:15

I saw on the Internet that I was supposed to use System.nanoTime() but that doesn\'t work for me - it gives me the time with milliseconds precision. I just need

12条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-03 02:10

    It may be the case that the underlying OS doesn't provide timers with nanosecond precision.

    There is also an older post.

提交回复
热议问题