Precise time measurement in Java

后端 未结 5 870
说谎
说谎 2021-02-07 07:28

Java gives access to two method to get the current time: System.nanoTime() and System.currentTimeMillis(). The first one gives a result in nanoseconds,

5条回答
  •  孤独总比滥情好
    2021-02-07 08:01

    If you are looking to record some type of phenomenon on the order of nanoseconds, what you really need is a real-time operating system. The accuracy of the timer will greatly depend on the operating system's implementation of its high resolution timer and the underlying hardware.

    However, you can still stay with Java since there are RTOS versions available.

提交回复
热议问题