Determine if the schedule is occurring at a given time
331620
def occurring_at?(time)
      time = TimeUtil.match_zone(time, start_time) or raise ArgumentError, "Time required, got #{time.inspect}"
      if duration > 0
        return false if exception_time?(time)
        occurs_between?(time - duration + 1, time)
      else
        occurs_at?(time)
      end
    end
622872
def isScheduleValid(self, schedule, node_srvs, force) -> (bool, str):
        

        # flag "force=True" ignore basic checks! only datetime format is
        # checked
        times = []
        non_demoted_nodes = set([k for k, v in node_srvs.items() if v])
        if not force and set(schedule.keys()) != non_demoted_nodes:
            return False, 'Schedule should contain id of all nodes'
        now = datetime.utcnow().replace(tzinfo=dateutil.tz.tzutc())
        for dateStr in schedule.values():
            try:
                when = dateutil.parser.parse(dateStr)
                if when <= now and not force:
                    return False, '{} is less than current time'.format(when)
                times.append(when)
            except ValueError:
                return False, '{} cannot be parsed to a time'.format(dateStr)
        if force:
            return True, ''
        times = sorted(times)
        for i in range(len(times) - 1):
            diff = (times[i + 1] - times[i]).total_seconds()
            if diff < self.config.MinSepBetweenNodeUpgrades:
                return False, 'time span between upgrades is {} ' \
                              'seconds which is less than specified ' \
                              'in the config'.format(diff)
        return True, ''
1313385
function timeMatch(value, cronTime){
  if(typeof(cronTime) == 'number'){
    if(cronTime == -1)
      return true;
    if(value == cronTime)
      return true;
    return false;
  }else if(typeof(cronTime) == 'object' && cronTime instanceof Array){
    if(value < cronTime[0] || value > cronTime[cronTime.length -1])
      return false;

    for(let i = 0; i < cronTime.length; i++)
      if(value == cronTime[i])
        return true;

    return false;
  }

  return null;
}
90092
def _schedule(self):
        ''''''
        if self._running:
            _logger.debug('')
            self._call_later_handle = self._event_loop.call_later(
                self._timeout, self._check)
1261194
def scheduled(self, offset=0, count=25):
        ''''''
        return self.client('jobs', 'scheduled', self.name, offset, count)
298443
def generate_schedule(today=None):
    """"""
    # We create a list of slots and schedule items
    schedule_days = {}
    seen_items = {}
    for slot in Slot.objects.all().order_by('end_time', 'start_time', 'day'):
        day = slot.get_day()
        if today and day != today:
            # Restrict ourselves to only today
            continue
        schedule_day = schedule_days.get(day)
        if schedule_day is None:
            schedule_day = schedule_days[day] = ScheduleDay(day)
        row = make_schedule_row(schedule_day, slot, seen_items)
        schedule_day.rows.append(row)
    return sorted(schedule_days.values(), key=lambda x: x.day.date)
1094329
def in_time_range?(time)
      time = Time.parse(time) if ! time.is_a?(Time)
      time_range.cover?(time)
    end
1040403
def scheduled?
      [:min, :hour, :day, :month, :wday].all? do |key|
        send(key).nil? || send(key) == now.send(key)
      end
    end
10640
def is_possible_hour(self, hour):
        """"""
        if hour > 23 and self.is_possible_hour(0):
            hour = int(hour)
        if not self._is_overnight:
            return self.st_time.hour <= hour <= self.end_time.hour
        else:
            return self.st_time.hour <= hour <= 23 or \
                0 <= hour <= self.end_time.hour
365988
def schedule(self, task: Schedulable, *args, **kwargs):
        
        at = datetime.now(timezone.utc)
        self.schedule_at(task, at, *args, **kwargs)
153322
def filter_schedules(schedules, now)

      now = Ruote.time_to_utc_s(now)

      schedules.select { |sch| sch['at'] <= now }
    end
853242
def get_scheduler_info():
    """"""

    scheduler = current_app.apscheduler

    d = OrderedDict([
        ('current_host', scheduler.host_name),
        ('allowed_hosts', scheduler.allowed_hosts),
        ('running', scheduler.running)
    ])

    return jsonify(d)
1334963
def _scheduleMePlease(self):
        
        sched = IScheduler(self.store)
        if len(list(sched.scheduledTimes(self))) == 0:
            sched.schedule(self, sched.now())
1117266
def is_same_time(self):
        """"""
        return (
            self.local
            and self.remote
            and FileEntry._eps_compare(self.local.mtime, self.remote.mtime) == 0
        )
474171
def schedule_window(report_type, start_at, stop_at, resolution):
    
    model_cls = get_scheduler_model(report_type)
    dbsession = db.create_scoped_session()
    schedules = dbsession.query(model_cls).filter(model_cls.active.is_(True))

    for schedule in schedules:
        args = (
            report_type,
            schedule.id,
        )

        # Schedule the job for the specified time window
        for eta in next_schedules(schedule.crontab,
                                  start_at,
                                  stop_at,
                                  resolution=resolution):
            schedule_email_report.apply_async(args, eta=eta)
1281152
public void scheduleInternalEvent(String name, Date time, String message, String reference) {
        schedule(name, time, message, reference);
    }
353605
function scheduleToSentence(schedule) {
    var outputText = locale.Every + ' ';

    if (schedule['h'] && schedule['m'] && schedule['h'].length <= 2 && schedule['m'].length <= 2) {
      // If there are only one or two specified values for
      // hour or minute, print them in HH:MM format

      var hm = [];
      for (var i = 0; i < schedule['h'].length; i++) {
        for (var j = 0; j < schedule['m'].length; j++) {
          hm.push(zeroPad(schedule['h'][i]) + ':' + zeroPad(schedule['m'][j]));
        }
      }
      if (hm.length < 2) {
        outputText = hm[0];
      } else {
        var lastVal = hm.pop();
        outputText = hm.join(', ') + ` ${locale.and} ` + lastVal;
      }
      if (!schedule['d'] && !schedule['D']) {
        outputText += ` ${locale['every day']}`;
      }
    } else {
      // Otherwise, list out every specified hour/minute value.

      if (schedule['h']) { // runs only at specific hours
        if (schedule['m']) { // and only at specific minutes
          outputText += numberList(schedule['m']) + ` ${locale['minute past the']} ` + numberList(schedule['h']) + ` ${locale['hour']}`;
        } else { // specific hours, but every minute
          outputText += `${locale['minute of']} ` + numberList(schedule['h']) + ` ${locale['hour']}`;
        }
      } else if (schedule['m']) { // every hour, but specific minutes
        outputText += numberList(schedule['m']) + ` ${locale['minute every hour']}`;
      } else { // cronspec has "*" for both hour and minute
        outputText += locale['minute'];
      }
    }

    if (schedule['D']) { // runs only on specific day(s) of month
      outputText += (locale['on the'] ? ` ${locale['on the']} ` : ' ') + numberList(schedule['D']);
      if (!schedule['M']) {
        outputText += ` ${locale['of every month']}`;
      }
    }

    if (schedule['d']) { // runs only on specific day(s) of week
      if (schedule['D']) {
        // if both day fields are specified, cron uses both; superuser.com/a/348372
        outputText += ` ${locale['and every']} `;
      } else {
        outputText += ` ${locale['on']} `;
      }
      outputText += dateList(schedule['d'], 'dow');
    }

    if (schedule['M']) {
      // runs only in specific months; put this output last
      outputText += ` ${locale['in']} ` + dateList(schedule['M'], 'mon');
    }

    return outputText;
  }