Example #1
0
 private long getMillis(long seconds, int nanoseconds) {
   try {
     return ExactMath.addExact(
         ExactMath.multiplyExact(seconds, 1000L), (nanoseconds / 1_000_000));
   } catch (ArithmeticException e) {
     CompilerDirectives.transferToInterpreter();
     String message =
         String.format(
             "UNIX epoch + %d seconds out of range for Time (Joda-Time limitation)", seconds);
     throw new RaiseException(getContext().getCoreLibrary().rangeError(message, this));
   }
 }
Example #2
0
 @Specialization(rewriteOn = ArithmeticException.class)
 protected long mul(long left, long right) {
   return ExactMath.multiplyExact(left, right);
 }