Get the first second (from midnight) where we are out of the timerange

        :return: seconds from midnight where timerange is not effective
        :rtype: int
763651
def get_first_sec_out_from_morning(self):
        
        # If start at 0:0, the min out is the end
        if self.hstart == 0 and self.mstart == 0:
            return self.hend * 3600 + self.mend * 60
        return 0
604504
def end_time(self):
        
        return float(self.strain.start_time + (len(self.strain) - self.total_corruption) / self.sample_rate)
452759
def _get_minutes_from_last_update(self, time):
        
        time_from_last_update = time - self.last_update_time
        return int(time_from_last_update.total_seconds() / 60)
850785
def getTime(self):
        
        T = 1/float(self.samp[self.nrates-1])
        endtime = self.endsamp[self.nrates-1] * T

        t = numpy.linspace(0,endtime,self.endsamp[self.nrates-1])

        return t
156658
public static int toSeconds(TimeRange timeRange) {
        if (timeRange.getFrom() == null || timeRange.getTo() == null) {
            return 0;
        }

        try {
            return Seconds.secondsBetween(timeRange.getFrom(), timeRange.getTo()).getSeconds();
        } catch (IllegalArgumentException e) {
            return 0;
        }
    }
1147463
private long getScanStartTimeSeconds() {
    // Begin with the raw query start time.
    long start = getStartTime();

    // Convert to seconds if we have a query in ms.
    if ((start & Const.SECOND_MASK) != 0L) {
      start /= 1000L;
    }
    
    // if we have a rollup query, we have different row key start times so find
    // the base time from which we need to search
    if (rollup_query != null) {
      long base_time = RollupUtils.getRollupBasetime(start, 
          rollup_query.getRollupInterval());
      if (rate) {
        // scan one row back so we can get the first rate value.
        base_time = RollupUtils.getRollupBasetime(base_time - 1, 
            rollup_query.getRollupInterval());
      }
      return base_time;
    }

    // First, we align the start timestamp to its representative value for the
    // interval in which it appears, if downsampling.
    long interval_aligned_ts = start;
    if (downsampler != null && downsampler.getInterval() > 0) {
      // Downsampling enabled.
      // TODO - calendar interval
      final long interval_offset = (1000L * start) % downsampler.getInterval();
      interval_aligned_ts -= interval_offset / 1000L;
    }

    // Then snap that timestamp back to its representative value for the
    // timespan in which it appears.
    final long timespan_offset = interval_aligned_ts % Const.MAX_TIMESPAN;
    final long timespan_aligned_ts = interval_aligned_ts - timespan_offset;

    // Don't return negative numbers.
    return timespan_aligned_ts > 0L ? timespan_aligned_ts : 0L;
  }
1205130
def get_min_sec_from_morning(self):
        
        mins = []
        for timerange in self.timeranges:
            mins.append(timerange.get_sec_from_morning())
        return min(mins)
771200
def rate_limited_old(max_per_second):
    
    lock = threading.Lock()
    min_interval = 1.0 / max_per_second

    def decorate(func):
        last_time_called = time.perf_counter()

        @wraps(func)
        def rate_limited_function(*args, **kwargs):
            lock.acquire()
            nonlocal last_time_called
            try:
                elapsed = time.perf_counter() - last_time_called
                left_to_wait = min_interval - elapsed
                if left_to_wait > 0:
                    time.sleep(left_to_wait)

                return func(*args, **kwargs)
            finally:
                last_time_called = time.perf_counter()
                lock.release()

        return rate_limited_function

    return decorate
119289
def elapsed_time(self):
        
        if self._end_time:
            elapsed_time = round(self._end_time - self._start_time, 3)
            return elapsed_time
        else:
            return None
503709
def _getMyFirstDatetimeFrom(self):
        
        myStartDt = getAwareDatetime(self.repeat.dtstart, None,
                                     self.tz, dt.time.min)
        return self.__after(myStartDt, excludeCancellations=False)
1244473
def _min_timezone_offset():
    ""
    now = time.time()
    return (datetime.datetime.fromtimestamp(now) - datetime.datetime.utcfromtimestamp(now)).seconds // 60
972767
def get_seconds_until_next_day(now=None):
    
    if now is None:
        now = arrow.utcnow()
    return (now.ceil('day') - now).seconds
639021
def stopwatch_now():
    
    if six.PY2:
        now = time.time()
    else:
        now = time.monotonic()
    return now
599642
def end_timing(self):
        

        if self._callback != None:
            elapsed = time.perf_counter() * 1000 - self._start
            self._callback.end_timing(self._counter, elapsed)
40610
static int findRelativeSecond(long delayMillis) {
        long now = Clock.currentTimeMillis();
        long d = (now + delayMillis - INITIAL_TIME_MILLIS);
        return ceilToSecond(d);
    }
571626
def calculate_delay(original, delay):
    
    original = datetime.strptime(original, '%H:%M')
    delayed = datetime.strptime(delay, '%H:%M')
    diff = delayed - original
    return diff.total_seconds() // 60
447497
def next_timer_delta(self):
        ""
        if self.timeouts and not self.active:
            now = getnow()
            timo = self.timeouts[0].timeout
            if now >= timo:
                #looks like we've exceded the time
                return 0
            else:
                return (timo - now)
        else:
            if self.active:
                return 0
            else:
                return None