code: private static boolean durationIsValid(long seconds, int nanos) {
      if (seconds < DURATION_SECONDS_MIN || seconds > DURATION_SECONDS_MAX) {
        return false;
      }
      if (nanos < -999999999L || nanos >= NANOS_PER_SECOND) {
        return false;
      }
      if (seconds < 0 || nanos < 0) {
        if (seconds > 0 || nanos > 0) {
          return false;
        }
      }
      return true;
    }
docs: Returns true if the given number of seconds and nanos is a valid {@code Duration}. The {@code
  seconds} value must be in the range [-315,576,000,000, +315,576,000,000]. The {@code nanos}
  value must be in the range [-999,999,999, +999,999,999].
  
  <p><b>Note:</b> Durations less than one second are represented with a 0 {@code seconds} field
  and a positive or negative {@code nanos} field. For durations of one second or more, a non-zero
  value for the {@code nanos} field must be of the same sign as the {@code seconds} field.
  
  <p>Copy of {@link com.google.protobuf.util.Duration#isValid}.</p>