An interface for getting the current value of a high-resolution time source, in nanoseconds.
Clocks other than NanoClock are typically used only for testing.
This interface is required in addition to Java 8's Clock, because nanoTime is required to
compare values with io.grpc.CallOptions.getDeadlineNanoTime().
Methods
millisTime()
publicabstractlongmillisTime()
Returns the current value of this clock's high-resolution time source, in milliseconds.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-15 UTC."],[[["\u003cp\u003eThis webpage lists the versions of the \u003ccode\u003eApiClock\u003c/code\u003e interface, a component of the Google API common library, with version 2.46.1 being the latest release.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eApiClock\u003c/code\u003e interface provides methods to get the current time in both milliseconds (\u003ccode\u003emillisTime()\u003c/code\u003e) and nanoseconds (\u003ccode\u003enanoTime()\u003c/code\u003e), which is useful for high-resolution time measurement.\u003c/p\u003e\n"],["\u003cp\u003eThe interface is primarily utilized for testing purposes, except for the \u003ccode\u003eNanoClock\u003c/code\u003e, which is used for different time measurement needs.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003enanoTime()\u003c/code\u003e method is necessary for comparing time values with \u003ccode\u003eio.grpc.CallOptions.getDeadlineNanoTime()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe currently viewed version on the page is 2.24.0, which includes the \u003ccode\u003eApiClock\u003c/code\u003e interface with the two methods, \u003ccode\u003emillisTime()\u003c/code\u003e and \u003ccode\u003enanoTime()\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,[]]