Copy of com.google.protobuf.util.Timestamps#parseNanos.
(String value)
| 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 |