MCPcopy Index your code
hub / github.com/grpc/grpc-java / timeRemaining

Method timeRemaining

api/src/context/java/io/grpc/Deadline.java:176–182  ·  view source on GitHub ↗

How much time is remaining in the specified time unit. Internal units are maintained as nanoseconds and conversions are subject to the constraints documented for TimeUnit#convert. If there is no time remaining, the returned duration is how long ago the deadline expired.

(TimeUnit unit)

Source from the content-addressed store, hash-verified

174 * long ago the deadline expired.
175 */
176 public long timeRemaining(TimeUnit unit) {
177 final long nowNanos = ticker.nanoTime();
178 if (!expired && deadlineNanos - nowNanos <= 0) {
179 expired = true;
180 }
181 return unit.convert(deadlineNanos - nowNanos, TimeUnit.NANOSECONDS);
182 }
183
184 /**
185 * Schedule a task to be run when the deadline expires.

Callers 15

interceptCallMethod · 0.95
interceptCallMethod · 0.95
ofMethod · 0.95
toStringMethod · 0.95
timeCanOverflowMethod · 0.95
timeCanUnderflowMethod · 0.95
pastDeadlineIsExpiredMethod · 0.95
setDeadlineMethod · 0.80
CancellationHandlerMethod · 0.80

Calls 2

nanoTimeMethod · 0.65
convertMethod · 0.45

Tested by 7

ofMethod · 0.76
timeCanOverflowMethod · 0.76
timeCanUnderflowMethod · 0.76
pastDeadlineIsExpiredMethod · 0.76