Handles generating occurrences with the default start and end times
765930
public function generateDefaultOccurrences(CalendarEventVersion $version)
    {
        $repetitions = $version->getRepetitionEntityCollection();
        $query = $this->entityManager->createQuery('delete from calendar:CalendarEventVersionOccurrence o where o.version = :version');
        $query->setParameter('version', $version);
        $query->execute();

        foreach($repetitions as $repetitionEntity) {

            $repetition = $repetitionEntity->getRepetitionObject();

            $start = $repetition->getStartDateTimestamp() - 1;

            $datetime = new \DateTime('+5 years', $repetition->getTimezone());
            $end = $datetime->getTimestamp();

            $this->occurrenceFactory->generateOccurrences($version, $repetitionEntity, $start, $end);
        }
    }
847819
def type_and_times(type_: str, start: Timestamp, end: Timestamp, probability: Number = None) -> str:
    
    if not type_:
        return ''
    if type_ == 'BECMG':
        return f"At {start.dt.hour or 'midnight'} zulu becoming"
    ret = f"From {start.dt.hour or 'midnight'} to {end.dt.hour or 'midnight'} zulu,"
    if probability and probability.value:
        ret += f" there's a {probability.value}% chance for"
    if type_ == 'INTER':
        ret += ' intermittent'
    elif type_ == 'TEMPO':
        ret += ' temporary'
    return ret
374361
def _time_query_parms(begin_time, end_time):
        """"""
        query_parms = []
        if begin_time is not None:
            begin_ts = timestamp_from_datetime(begin_time)
            qp = 'begin-time={}'.format(begin_ts)
            query_parms.append(qp)
        if end_time is not None:
            end_ts = timestamp_from_datetime(end_time)
            qp = 'end-time={}'.format(end_ts)
            query_parms.append(qp)
        query_parms_str = '&'.join(query_parms)
        if query_parms_str:
            query_parms_str = '?' + query_parms_str
        return query_parms_str
120185
def _rnd_date(start, end):
    
    return date.fromordinal(random.randint(start.toordinal(), end.toordinal()))
1098282
function momentRandom(end = moment(), start) {
  const endTime = +moment(end);
  const randomNumber = (to, from = 0) =>
    Math.floor(Math.random() * (to - from) + from);

  if (start) {
    const startTime = +moment(start);
    if (startTime > endTime) {
      throw new Error('End date is before start date!');
    }
    return moment(randomNumber(endTime, startTime));
  }
  return moment(randomNumber(endTime));
}
1341640
def last(n = nil)
      require_terminating_rules
      occurrences = enumerate_occurrences(start_time).to_a
      n.nil? ? occurrences.last : occurrences[-n..-1]
    end
1065976
def _start_end(date_range, dts):
    
    # FIXME: timezones
    assert len(dts)
    _assert_no_timezone(date_range)
    date_range = to_pandas_closed_closed(date_range, add_tz=False)
    start = np.datetime64(date_range.start) if date_range.start else dts[0]
    end = np.datetime64(date_range.end) if date_range.end else dts[-1]
    return start, end
236265
public function generateOccurrences(CalendarEventVersion $version, CalendarEventVersionRepetition $repetitionEntity, $start_time, $end_time)
    {

        $saver = \Core::make(EventOccurrenceService::class);

        $repetition = $repetitionEntity->getRepetitionObject();

        $occurrences = $repetition->activeRangesBetween($start_time, $end_time);

        $initial_occurrence_time = (new \DateTime($repetition->getStartDate(), $repetition->getTimezone()))
            ->getTimestamp();
        if ($repetition->getEndDate()) {
            $initial_occurrence_time_end = (new \DateTime($repetition->getEndDate(), $repetition->getTimezone()))
                ->getTimestamp();
        } else {
            $initial_occurrence_time_end = $initial_occurrence_time;
        }

        $initial_occurrence = $this->createEventOccurrence(
            $version,
            $repetitionEntity->getRepetition(),
            $initial_occurrence_time,
            $initial_occurrence_time_end
        );

        if ($initial_occurrence_time >= $start_time && $initial_occurrence_time <= $end_time) {
            $saver->save($initial_occurrence);
        }

        $all_occurrences = array();
        foreach ($occurrences as $occurrence) {
            if ($occurrence[0] === $initial_occurrence->getStart()) {
                continue;
            }
            $all_occurrences[] = $saver->save(
                $this->createEventOccurrence($version, $repetitionEntity->getRepetition(), $occurrence[0], $occurrence[1])
            );
        }

        return $all_occurrences;
    }
1327408
def _rnd_datetime(self, start, end):
        
        return self.from_utctimestamp(
            random.randint(
                int(self.to_utctimestamp(start)),
                int(self.to_utctimestamp(end)),
            )
        )
1001588
function end () {
  var diff = new Date() - startTime

  log('\n\n')
  log('  ' + SYMBOLS.success + ' ' + (stats.success + ' passing ').green)
  log(('(' + diff + 'ms)').grey)

  if (stats.skipped) {
    log('\n  ' + SYMBOLS.skipped + ' ' + (stats.skipped + ' pending').cyan)
  }

  if (stats.failure) {
    log('\n  ' + SYMBOLS.failure + ' ' + (stats.failure + ' failing').red)

    // Log all accumulated errors
    log('\n\n')
    failures.forEach(logError)
  }

  log('\n\n')
}
157503
function interval(start, end) {
  if (arguments.length === 1 && typeof start === 'string') {
    return start
  }
  else if (arguments.length === 2) {
    var interval = utils.args(arguments, 0)

    return interval.map(function(original) {
      var arg = utils.date(original)

      if (!arg) {
        throw new FieldError('Bad date specified: ' + original)
      }

      return JSON.stringify(arg).replace(/"/g, '')
    }).join('/')
  }
  else {
    throw new FieldError('Bad arguments')
  }
}
810805
def strftimegen(start_dt, end_dt):
    
    if start_dt > end_dt:
        raise ValueError("the start datetime is after the end datetime: (%r,%r)" % (start_dt, end_dt))

    def iterftime(string):
        date_subs = [i for i in DATE_FORMATS if i[1].search(string) is not None]
        if not date_subs:
            yield string
        else:
            dt = start_dt
            date_path = string
            while end_dt >= dt:
                for item in date_subs:
                    date_path = item[1].sub(dt.strftime(item[0]), date_path)
                yield date_path
                dt = dt + datetime.timedelta(days=1)

    return iterftime
380071
def timeframe(self, start, end):
        
        """
        if start:
            self._time_frame['chfieldfrom'] = start
        if end:
            self._time_frame['chfieldto'] = end
        return self
586041
def events_for_date_range(start_d, end_d, find_options = {})
      self.scoped(find_options).find(
        :all,
        :conditions => [ "(? <= #{self.quoted_table_name}.#{self.end_at_field}) AND (#{self.quoted_table_name}.#{self.start_at_field}< ?)", start_d.to_time.utc, end_d.to_time.utc ],
        :order => "#{self.quoted_table_name}.#{self.start_at_field} ASC"
      )
    end
218109
function printTimingAndExit(startTime) {
  const execTime = time() - startTime;

  printColumns(chalk.green(`Finished in: ${execTime.toFixed()}ms`));
  process.exit(0);
}
928952
def list_occurrences(from, direction = :forward, &block)
      raise ArgumentError, "From #{from} not matching the rule #{@rule} and start time #{@start_time}" unless @rule.match?(from, @start_time)

      results = []

      n, current = init_loop(from, direction)
      loop do
        # Rails.logger.debug("Listing occurrences of #{@rule}, going #{direction.to_s}, current: #{current}")
        # break on schedule span limits
        return results unless (current >= @start_time) && (@rule.stop.nil? || current < @rule.stop) && (@rule.count.nil? || (n -= 1) >= 0)

        # break on block condition
        return results unless yield current

        results << current

        # step
        if direction == :forward
          current = @rule.next(current, @start_time)
        else
          current = @rule.previous(current, @start_time)
        end
      end
    end
990321
function genValidHourValues(b24H, sLeadingChar) {
				var iStart = b24H ? 0 : 1,
					b2400 = this._oTimePicker.getSupport2400() ? 24 : 23,//if getSupport2400, the user could type 24 in the input
					iEnd = b24H ? b2400 : 12;

				return genValues(iStart, iEnd, sLeadingChar);
			}