If n is positive, return tomorrow's business day opening time.
        Otherwise yesterday's business day's opening time.

        Opening time always locates on BusinessDay.
        Otherwise, closing time may not if business hour extends over midnight.
545623
def _next_opening_time(self, other):
        
        if not self.next_bday.onOffset(other):
            other = other + self.next_bday
        else:
            if self.n >= 0 and self.start < other.time():
                other = other + self.next_bday
            elif self.n < 0 and other.time() < self.start:
                other = other + self.next_bday
        return datetime(other.year, other.month, other.day,
                        self.start.hour, self.start.minute)
738137
def _local_times_from_hours_since_midnight(times, hours):
    
    tz_info = times.tz  # pytz timezone info
    naive_times = times.tz_localize(None)  # naive but still localized
    # normalize local, naive times to previous midnight and add the hours until
    # sunrise, sunset, and transit
    return pd.DatetimeIndex(
        (naive_times.normalize().astype(np.int64) +
         (hours * NS_PER_HR).astype(np.int64)).astype('datetime64[ns]'),
        tz=tz_info)
1094144
def rollback(self, dt):
        
        if not self.onOffset(dt):
            businesshours = self._get_business_hours_by_sec
            if self.n >= 0:
                dt = self._prev_opening_time(
                    dt) + timedelta(seconds=businesshours)
            else:
                dt = self._next_opening_time(
                    dt) + timedelta(seconds=businesshours)
        return dt
1114620
def in_hours(self, when):
		

		# convert to local timezone
		when = when.astimezone(self.tz)

		# is it a work day?
		if when.weekday() not in self.hours:
			# not a work day
			return False

		# work out if it is one of the ranges
		for start, end in self.hours[when.weekday()]:
			if start <= when.time() <= end:
				# it's in that range

				# is it a public holiday?  check if it is any range
				for hstart, hend in self.holidays:
					if when >= hstart and when <= hend:
						# it's inside a holiday area.
						return False

				# not in a holiday zone, which means it's business time.
				return True

		# not in any range of hours, and was on a work day
		return False
190414
def time_afterwards_preceding(
            self, when: datetime.datetime) -> Optional[datetime.timedelta]:
        
        if self.is_empty():
            return None
        end_time = self.end_datetime()
        if when <= end_time:
            return datetime.timedelta()
        else:
            return when - end_time
1300623
def next_time(self, asc=False):
        
        _time = time.localtime(time.time() + self.next())

        if asc:
            return time.asctime(_time)

        return time.mktime(_time)
393207
def available_on_day(self, day):
        
        if isinstance(day, datetime):
            d = day.date()
        else:
            d = day
        return self.starts_within(d, d)
540970
function (hour) {
      if (this.settings.hour === 12) {
        switch (hour) {
          case 0:
          case 24:
            hour = '12am';
            break;
          case 12:
            hour = '12pm';
            break;
          default:
            if (hour > 12) {
              hour = (hour - 12) + 'pm';
            } else {
              hour += 'am';
            }
        }
      } else {
        if (hour >= 24) {
          hour = 0;
        }

        if (hour < 10) {
          hour = '0' + hour;
        }
        hour += ':00';
      }

      return hour;
    }
906457
def when(self):
        
        offset   = 0
        timeFrom = dateFrom = timeTo = dateTo = None
        fromDt   = self._getFromDt()
        if fromDt is not None:
            offset = timezone.localtime(fromDt).toordinal() - fromDt.toordinal()
            dateFrom, timeFrom = getLocalDateAndTime(fromDt.date(), self.time_from,
                                                     self.tz, dt.time.min)
            daysDelta = dt.timedelta(days=self.num_days - 1)
            dateTo, timeTo = getLocalDateAndTime(fromDt.date() + daysDelta,
                                                 self.time_to, self.tz)
        if dateFrom == dateTo:
            retval = _("{repeat} {atTime}").format(
                    repeat=self.repeat._getWhen(offset),
                    atTime=timeFormat(timeFrom, timeTo, gettext("at ")))
        else:
            localNumDays = (dateTo - dateFrom).days + 1
            retval = _("{repeat} {startFinishTime}").format(
                    repeat=self.repeat._getWhen(offset, localNumDays),
                    startFinishTime=timeFormat(timeFrom, timeTo,
                                               prefix=gettext("starting at "),
                                               infix=gettext("finishing at")))
        return retval.strip()
385289
def check_time(value):
    """"""
    try:
        h, m = value.split(':')
        h = int(h)
        m = int(m)
        if h >= 24 or h < 0:
            raise ValueError
        if m >= 60 or m < 0:
            raise ValueError
    except ValueError:
        raise TimeDefinitionError("Invalid definition of time %r" % value)
536100
public static int getHour(Date timeFrom) {
		Calendar instance = Calendar.getInstance();
		instance.setTime(timeFrom);
		int hour = instance.get(Calendar.HOUR);
		return hour;

	}
1149917
private static int isTodayOrTomorrow(Resources r, long dayMillis,
                                         long currentMillis, long localGmtOffset) {
        int startDay = Time.getJulianDay(dayMillis, localGmtOffset);
        int currentDay = Time.getJulianDay(currentMillis, localGmtOffset);

        int days = startDay - currentDay;
        if (days == 1) {
            return TOMORROW;
        } else if (days == 0) {
            return TODAY;
        } else {
            return NONE;
        }
    }
326612
def show_time(self, end=False):
        """"""
        if self.time_label is None:
            return

        elapsed_time = time.monotonic() - self.t0
        # System time changed to past date, so reset start.
        if elapsed_time < 0:
            self.t0 = time.monotonic()
            elapsed_time = 0
        if elapsed_time > 24 * 3600:  # More than a day...!
            fmt = "%d %H:%M:%S"
        else:
            fmt = "%H:%M:%S"
        if end:
            color = "#AAAAAA"
        else:
            color = "#AA6655"
        text = "<span style=\'color: %s\'><b>%s" \
               "</b></span>" % (color,
                                time.strftime(fmt, time.gmtime(elapsed_time)))
        self.time_label.setText(text)
227949
def end_time(self):
        """"""
        try:
            return self.start_time + SCAN_DURATION[self.sector]
        except KeyError:
            return self.start_time
1321582
def background_time(self):
        """"""
        time = 1.0 / self.timeslide_interval
        for ifo in self.singles:
            time *= self.singles[ifo].filled_time * self.analysis_block
        return time
462747
private void selectDefaultDate() {
        Calendar today = Calendar.getInstance();
        int hour = -1, minute = -1;

        // get the next possible selection
        Calendar date = getNextItemDate(today);
        // if it is the today item, we need to take a look the time
        if(date != null && DateSpinner.compareCalendarDates(date, today) == 0) {
            // same as getNextTimeDate for TimeSpinner
            final int last = timeSpinner.getLastItemPosition();
            final int searchHour = today.get(Calendar.HOUR_OF_DAY),
                    searchMinute = today.get(Calendar.MINUTE);
            for (int i=0; i<=last; i++) {
                final TimeItem time = ((TimeItem) timeSpinner.getItemAtPosition(i));
                if(time.getHour() > searchHour || (time.getHour() == searchHour && time.getMinute() >= searchMinute)) {
                    hour = time.getHour();
                    minute = time.getMinute();
                    break;
                }
            }

            // it may be too late in the evening to select the today item
            // or if FLAG_HIDE_TIME has been set, set it to tomorrow morning:
            if((hour == -1 && minute == -1) || shouldHideTime) {
                Calendar tomorrow = (Calendar) today.clone();
                tomorrow.add(Calendar.DAY_OF_YEAR, 1);
                date = getNextItemDate(tomorrow); // if this returns null it'll be set to today below
            }
        }
        if(date == null) {
            // it seems this spinner only contains past items, use the last one
            date = ((DateItem) dateSpinner.getItemAtPosition(dateSpinner.getLastItemPosition())).getDate();
        }

        if(hour == -1 && minute == -1) {
            // the date is not today, just select the earliest possible time
            final TimeItem time = ((TimeItem) timeSpinner.getItemAtPosition(0));
            hour = time.getHour();
            minute = time.getMinute();
        }

        // finally, select what we found
        date.set(Calendar.HOUR_OF_DAY, hour);
        date.set(Calendar.MINUTE, minute);
        setSelectedDate(date);
    }
587109
def business_hours_schedule_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/business_hours/schedules/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)