MCPcopy Create free account
hub / github.com/grpc/grpc-java / parseNanos

Method parseNanos

core/src/main/java/io/grpc/internal/JsonUtil.java:345–357  ·  view source on GitHub ↗

Copy of com.google.protobuf.util.Timestamps#parseNanos.

(String value)

Source from the content-addressed store, hash-verified

343 * Copy of {@link com.google.protobuf.util.Timestamps#parseNanos}.
344 */
345 private static int parseNanos(String value) throws ParseException {
346 int result = 0;
347 for (int i = 0; i < 9; ++i) {
348 result = result * 10;
349 if (i < value.length()) {
350 if (value.charAt(i) < '0' || value.charAt(i) > '9') {
351 throw new ParseException("Invalid nanoseconds.", 0);
352 }
353 result += value.charAt(i) - '0';
354 }
355 }
356 return result;
357 }
358
359 private static final int NANOS_PER_SECOND = 1_000_000_000;
360

Callers 1

parseDurationMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected