<p>
Determine the next time (in milliseconds) that is 'included' by the
Calendar after the given time. Return the original value if timeStamp is
included. Return 0 if all days are excluded.
</p>

@see com.helger.quartz.ICalendar#getNextIncludedTime(long)
355487
public long getNextIncludedTime (final long timeStamp)
  {
    if (timeStamp <= 0)
      throw new IllegalArgumentException ("timeStamp must be greater 0");

    if (m_aBaseCalendar != null)
    {
      return m_aBaseCalendar.getNextIncludedTime (timeStamp);
    }

    return timeStamp;
  }
908140
@Override
    public Date nextExecutionTime(TriggerContext triggerContext) {
        if (triggerContext.lastScheduledExecutionTime() == null) {
            return new Date(System.currentTimeMillis() + this.initialDelay);
        } else if (this.fixedRate) {
            return new Date(triggerContext.lastScheduledExecutionTime().getTime() + this.period);
        }
        return new Date(triggerContext.lastCompletionTime().getTime() + this.period);
    }
408485
private boolean isTimeAfterOrEquals(Calendar time1, Calendar time2) {
        return !(time1 == null || time2 == null) && time1.getTimeInMillis() >= time2.getTimeInMillis();
    }
427899
function nextTime(value, cronTime){
  if(typeof(cronTime) == 'number'){
    if(cronTime == -1)
      return value + 1;
    else
      return cronTime;
  }else if(typeof(cronTime) == 'array'){
    if(value < arr[0] || value > arr[arr.length -1])
      return arr[0];
    
    for(let i = 0; i < arr.length; i++)
      if(value < arr[i])
        return arr[i];
  }
  
  return null;
}
15325
@Override
    public int countMissing() {
        int count = 0;
        for (int i = 0; i < size(); i++) {
            if (getPackedDateTime(i) == DateTimeColumnType.missingValueIndicator()) {
                count++;
            }
        }
        return count;
    }
307419
@Override
  public boolean isTimeIncluded (final long timeStamp)
  {
    if (m_bExcludeAll == true)
    {
      return false;
    }

    // Test the base calendar first. Only if the base calendar not already
    // excludes the time/date, continue evaluating this calendar instance.
    if (super.isTimeIncluded (timeStamp) == false)
    {
      return false;
    }

    final Calendar cl = createJavaCalendar (timeStamp);
    final int wday = cl.get (Calendar.DAY_OF_WEEK);

    return !(isDayExcluded (wday));
  }
416208
@Override
    public TimeZoneTransition getNextTransition(long base, boolean inclusive) {
        initTransitionRules();

        if (finalZone != null) {
            if (inclusive && base == firstFinalTZTransition.getTime()) {
                return firstFinalTZTransition;
            } else if (base >= firstFinalTZTransition.getTime()) {
                if (finalZone.useDaylightTime()) {
                    //return finalZone.getNextTransition(base, inclusive);
                    return finalZoneWithStartYear.getNextTransition(base, inclusive);
                } else {
                    // No more transitions
                    return null;
                }
            }
        }
        if (historicRules != null) {
            // Find a historical transition
            int ttidx = transitionCount - 1;
            for (; ttidx >= firstTZTransitionIdx; ttidx--) {
                long t = transitionTimes64[ttidx] * Grego.MILLIS_PER_SECOND;
                if (base > t || (!inclusive && base == t)) {
                    break;
                }
            }
            if (ttidx == transitionCount - 1)  {
                return firstFinalTZTransition;
            } else if (ttidx < firstTZTransitionIdx) {
                return firstTZTransition;
            } else {
                // Create a TimeZoneTransition
                TimeZoneRule to = historicRules[getInt(typeMapData[ttidx + 1])];
                TimeZoneRule from = historicRules[getInt(typeMapData[ttidx])];
                long startTime = transitionTimes64[ttidx+1] * Grego.MILLIS_PER_SECOND;

                // The transitions loaded from zoneinfo.res may contain non-transition data
                if (from.getName().equals(to.getName()) && from.getRawOffset() == to.getRawOffset()
                        && from.getDSTSavings() == to.getDSTSavings()) {
                    return getNextTransition(startTime, false);
                }

                return new TimeZoneTransition(startTime, from, to);
            }
        }
        return null;
    }
777210
private int getCurrentlyShowingValue() {
        int currentIndex = getCurrentItemShowing();
        switch(currentIndex) {
            case HOUR_INDEX:
                return mCurrentTime.getHour();
            case MINUTE_INDEX:
                return mCurrentTime.getMinute();
            case SECOND_INDEX:
                return mCurrentTime.getSecond();
            default:
                return -1;
        }
    }
1109514
@Override
  public Date getFinalFireTime ()
  {
    if (m_bComplete || getEndTime () == null)
    {
      return null;
    }

    // back up a second from end time
    Date fTime = new Date (getEndTime ().getTime () - 1000L);
    // find the next fire time after that
    fTime = getFireTimeAfter (fTime, true);

    // the the trigger fires at the end time, that's it!
    if (fTime.equals (getEndTime ()))
      return fTime;

    // otherwise we have to back up one interval from the fire time after the
    // end time

    final Calendar lTime = PDTFactory.createCalendar ();
    if (m_aTimeZone != null)
      lTime.setTimeZone (m_aTimeZone);
    lTime.setTime (fTime);
    lTime.setLenient (true);

    if (getRepeatIntervalUnit ().equals (EIntervalUnit.SECOND))
    {
      lTime.add (Calendar.SECOND, -1 * getRepeatInterval ());
    }
    else
      if (getRepeatIntervalUnit ().equals (EIntervalUnit.MINUTE))
      {
        lTime.add (Calendar.MINUTE, -1 * getRepeatInterval ());
      }
      else
        if (getRepeatIntervalUnit ().equals (EIntervalUnit.HOUR))
        {
          lTime.add (Calendar.HOUR_OF_DAY, -1 * getRepeatInterval ());
        }
        else
          if (getRepeatIntervalUnit ().equals (EIntervalUnit.DAY))
          {
            lTime.add (Calendar.DAY_OF_YEAR, -1 * getRepeatInterval ());
          }
          else
            if (getRepeatIntervalUnit ().equals (EIntervalUnit.WEEK))
            {
              lTime.add (Calendar.WEEK_OF_YEAR, -1 * getRepeatInterval ());
            }
            else
              if (getRepeatIntervalUnit ().equals (EIntervalUnit.MONTH))
              {
                lTime.add (Calendar.MONTH, -1 * getRepeatInterval ());
              }
              else
                if (getRepeatIntervalUnit ().equals (EIntervalUnit.YEAR))
                {
                  lTime.add (Calendar.YEAR, -1 * getRepeatInterval ());
                }

    return lTime.getTime ();
  }
191883
public DateValue next() {
        if (null == this.pendingUtc_) {
            this.fetchNext();
        }
        DateValue next = this.pendingUtc_;
        this.pendingUtc_ = null;
        return next;
    }
928811
public Date getExecutionTimeNext() {

        if (!m_active || (m_trigger == null)) {
            // if the job is not active, no time can be calculated
            return null;
        }
        if (m_nextFireTime == null) {
            // in case next time is not set, check if the trigger supplies a valid next fire time
            Date next = m_trigger.getNextFireTime();
            if (System.currentTimeMillis() < next.getTime()) {
                m_nextFireTime = next;
            }
        }
        return m_nextFireTime;
    }
908492
protected Date getTimeAfter (final Date afterTime)
  {
    return (m_aCronEx == null) ? null : m_aCronEx.getTimeAfter (afterTime);
  }
891592
@Override
    public boolean isTimeIncluded(long timeStamp) {
        Date lookFor = getStartOfDayJavaCalendar(timeStamp).getTime();
        boolean include=workdays.contains(lookFor);
        return include;
    }
476773
def next_close(self, dt):
        
        idx = next_divider_idx(self.market_closes_nanos, dt.value)
        return pd.Timestamp(self.market_closes_nanos[idx], tz=UTC)
881107
public Date getNextInvalidTimeAfter(final Date date) {
        long difference = 999;

        //move back to the nearest second so differences will be accurate
        final Calendar adjustCal = Calendar.getInstance(getTimeZone());
        adjustCal.setTime(date);
        adjustCal.set(Calendar.MILLISECOND, 0);
        Date lastDate = adjustCal.getTime();

        Date newDate;

        //FUTURE_TODO: (QUARTZ-481) IMPROVE THIS! The following is a BAD solution to this problem. Performance will be very bad here, depending on the cron expression. It is, however A solution.

        //keep getting the next included time until it's farther than one second
        // apart. At that point, lastDate is the last valid fire time. We return
        // the second immediately following it.
        while (difference == 999) {
            newDate = getTimeAfter(lastDate);
            if (newDate == null)
                break;

            difference = newDate.getTime() - lastDate.getTime();

            if (difference == 999) {
                lastDate = newDate;
            }
        }

        return new Date(
                        lastDate.getTime() + 1000);
    }
1364834
@Override
    @SuppressWarnings("unchecked")
    public D plus(TemporalAmount amount) {
        return (D) ChronoLocalDate.super.plus(amount);
    }
1162033
def include?(timestamp)
      return false if earlier?(timestamp) || later?(timestamp)

      recurrence = finite? ? self : starts(timestamp)

      recurrence.events.lazy.each do |event|
        return true if event == timestamp
        return false if event > timestamp
      end or false
    end