Reformulates negative offsets or offsets larger than interval.

@param intervalInMinutes
@param offsetInMinutes
@return offset in milliseconds
178861
public static long calculateOffsetInMs(int intervalInMinutes, int offsetInMinutes) {
		while (offsetInMinutes < 0) {
			offsetInMinutes = intervalInMinutes + offsetInMinutes;
		}
		while (offsetInMinutes > intervalInMinutes) {
			offsetInMinutes -= intervalInMinutes;
		}
		return offsetInMinutes * MINUTE_IN_MS;
	}
586681
public static Collection<TimeSlot> calculateTimeSots( Day day, int intervalSeconds, Time startTime, Time endTime)
   {
      if(intervalSeconds <1)
      {
         throw new IllegalArgumentException("interval seconds cannot be less than one");
      }
      
      int count = 1*60*60*24/intervalSeconds;
      
      ArrayList<TimeSlot> slots = new ArrayList<TimeSlot>(count);   
      
      TimeSlot startSlot = TimeSlot.firstSlot(day,startTime, intervalSeconds);
      TimeSlot slot = startSlot;
      
      while(slot != null)
      {
         slots.add(slot);
         slot = slot.nextTimeSlot(intervalSeconds,endTime);
      }          
      
      return slots;
   }
1249844
public static int fromHours(int hours) {
        int refreshRate = hours * RefreshRate.SECONDS_PER_HOUR;

        RefreshRate.validateRefreshRate(refreshRate);

        return refreshRate;
    }
332375
public static OffsetTime time(EvaluationContext ctx, Object hours, Object minutes, Object seconds) {
        int _hours = Conversions.toInteger(hours, ctx);
        int _minutes = Conversions.toInteger(minutes, ctx);
        int _seconds = Conversions.toInteger(seconds, ctx);
        LocalTime localTime = LocalTime.of(_hours, _minutes, _seconds);
        return ZonedDateTime.of(LocalDate.now(ctx.getTimezone()), localTime, ctx.getTimezone()).toOffsetDateTime().toOffsetTime();
    }
210794
function parseTimezoneOffset (offset) {
  let [, sign, hours, minutes] = offset.match(/(\+|-)(\d\d)(\d\d)/)
  minutes = (sign === '+' ? 1 : -1) * (Number(hours) * 60 + Number(minutes))
  return negateExceptForZero(minutes)
}
742424
public static DateTime offsetMinute(Date date, int offset) {
		return offset(date, DateField.MINUTE, offset);
	}
1317554
@Nullable
    public static Double degreesMinutesSecondsToDecimal(@NotNull final Rational degs, @NotNull final Rational mins, @NotNull final Rational secs, final boolean isNegative)
    {
        double decimal = Math.abs(degs.doubleValue())
                + mins.doubleValue() / 60.0d
                + secs.doubleValue() / 3600.0d;

        if (Double.isNaN(decimal))
            return null;

        if (isNegative)
            decimal *= -1;

        return decimal;
    }
1172232
def millis_interval(start, end):
    """"""
    diff = end - start
    millis = diff.days * 24 * 60 * 60 * 1000
    millis += diff.seconds * 1000
    millis += diff.microseconds / 1000
    return millis
1072478
private void getOffset(long time, boolean local, int NonExistingTimeOpt, int DuplicatedTimeOpt, int[] offsets) {
        complete();
        TimeZoneRule rule = null;
        if (historicTransitions == null) {
            rule = initialRule;
        } else {
            long tstart = getTransitionTime(historicTransitions.get(0),
                    local, NonExistingTimeOpt, DuplicatedTimeOpt);
            if (time < tstart) {
                rule = initialRule;
            } else {
                int idx = historicTransitions.size() - 1;
                long tend = getTransitionTime(historicTransitions.get(idx),
                        local, NonExistingTimeOpt, DuplicatedTimeOpt);
                if (time > tend) {
                    if (finalRules != null) {
                        rule = findRuleInFinal(time, local, NonExistingTimeOpt, DuplicatedTimeOpt);
                    }
                    if (rule == null) {
                        // no final rules or the given time is before the first transition
                        // specified by the final rules -> use the last rule
                        rule = (historicTransitions.get(idx)).getTo();
                    }
                } else {
                    // Find a historical transition
                    while (idx >= 0) {
                        if (time >= getTransitionTime(historicTransitions.get(idx),
                                local, NonExistingTimeOpt, DuplicatedTimeOpt)) {
                            break;
                        }
                        idx--;
                    }
                    rule = (historicTransitions.get(idx)).getTo();
                }
            }
        }
        offsets[0] = rule.getRawOffset();
        offsets[1] = rule.getDSTSavings();
    }
697030
public static ClockInterval from(ChronoInterval<PlainTime> interval) {

        if (interval instanceof ClockInterval) {
            return ClockInterval.class.cast(interval);
        } else {
            return new ClockInterval(interval.getStart(), interval.getEnd());
        }

    }
1341524
public Interval expand(Interval<E> other)
  {
    if (other == null) return this;
    E a = min(this.first, other.first);
    E b = max(this.second, other.second);
    return toInterval(a,b);
  }
715219
public long getWindowMinLoadTime(final String intervalName, final TimeUnit unit) {
		final long min = windowMinLoadTime.getValueAsLong(intervalName);
		return min == Constants.MIN_TIME_DEFAULT ? min : unit.transformMillis(min);
	}
170148
function getHrTimeDurationInMs (startTime, endTime) {
    if (startTime === null || endTime === null) {
        return null;
    }

    var secondDiff = endTime[0] - startTime[0];
    var nanoSecondDiff = endTime[1] - startTime[1];
    var diffInNanoSecond = secondDiff * NS_PER_SEC + nanoSecondDiff;

    return Math.round(diffInNanoSecond / MS_PER_NS);
}
1102407
public long getWindowLastLoadTime(final String intervalName, final TimeUnit unit) {
		return unit.transformMillis(windowLastLoadTime.getValueAsLong(intervalName));
	}
674586
@Override
  public boolean isTimeIncluded (final long timeInMillis)
  {
    if (getBaseCalendar () != null && !getBaseCalendar ().isTimeIncluded (timeInMillis))
    {
      return false;
    }

    return !m_aCronExpression.isSatisfiedBy (new Date (timeInMillis));
  }
1346102
private void setMaxMin(IntervalRBTreeNode<T> n) {
    n.min = n.left;
    n.max = n.right;
    if (n.leftChild != null) {
      n.min = Math.min(n.min, n.leftChild.min);
      n.max = Math.max(n.max, n.leftChild.max);
    }
    if (n.rightChild != null) {
      n.min = Math.min(n.min, n.rightChild.min);
      n.max = Math.max(n.max, n.rightChild.max);
    }
  }
1313648
@VisibleForTesting
  static List<Interval> filterSkipIntervals(Interval totalInterval, List<Interval> skipIntervals)
  {
    final List<Interval> filteredIntervals = new ArrayList<>(skipIntervals.size() + 1);

    DateTime remainingStart = totalInterval.getStart();
    DateTime remainingEnd = totalInterval.getEnd();
    for (Interval skipInterval : skipIntervals) {
      if (skipInterval.getStart().isBefore(remainingStart) && skipInterval.getEnd().isAfter(remainingStart)) {
        remainingStart = skipInterval.getEnd();
      } else if (skipInterval.getStart().isBefore(remainingEnd) && skipInterval.getEnd().isAfter(remainingEnd)) {
        remainingEnd = skipInterval.getStart();
      } else if (!remainingStart.isAfter(skipInterval.getStart()) && !remainingEnd.isBefore(skipInterval.getEnd())) {
        filteredIntervals.add(new Interval(remainingStart, skipInterval.getStart()));
        remainingStart = skipInterval.getEnd();
      } else {
        // Ignore this skipInterval
        log.warn(
            "skipInterval[%s] is not contained in remainingInterval[%s]",
            skipInterval,
            new Interval(remainingStart, remainingEnd)
        );
      }
    }

    if (!remainingStart.equals(remainingEnd)) {
      filteredIntervals.add(new Interval(remainingStart, remainingEnd));
    }

    return filteredIntervals;
  }