code: public long toNanosLong() {
          if (Math.abs(getSec()) >= (Long.MAX_VALUE / NANOSEC_IN_SEC)) {
              throw new ArithmeticException("Overflow: duration cannot be represented in nanoseconds as long");
          }
          
          return getSec() * NANOSEC_IN_SEC + getNanoSec();
      }
docs: Returns the duration in nanoseconds. If the duration exceeds the
  range of a long, an exception is thrown.
  <p>
  The maximum duration is years is 2^63 / 1,000,000,000 / 60 / 60 / 24 / 365
  = about 292 years. Which is safe for many many cases.
  
  @return the duration in nanoseconds