Class NanoClock (2.20.0)

publicfinalclassNanoClockimplementsApiClock,Serializable

Default implementation of the ApiClock interface, using call to System.nanoTime().

Static Methods

getDefaultClock()

publicstaticApiClockgetDefaultClock()
Returns
TypeDescription
ApiClock

Methods

millisTime()

publicfinallongmillisTime()

Returns the current value of this clock's high-resolution time source, in milliseconds.

Returns
TypeDescription
long

nanoTime()

publicfinallongnanoTime()

Returns the current value of this clock's high-resolution time source, in nanoseconds.

Returns
TypeDescription
long

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-01-31 UTC.