Returns the number of seconds until the next day (utc midnight). This is the long-term rate limit used by Strava.
    :param now: A (utc) timestamp
    :type now: arrow.arrow.Arrow
    :return: the number of seconds until next day, as int
972767
def get_seconds_until_next_day(now=None):
    
    if now is None:
        now = arrow.utcnow()
    return (now.ceil('day') - now).seconds
1300623
def next_time(self, asc=False):
        
        _time = time.localtime(time.time() + self.next())

        if asc:
            return time.asctime(_time)

        return time.mktime(_time)
801486
def duration(start, end=None):
    
    if not end:
        end = datetime.now()
    td = end - start
    return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 1000000) \
        / 1000000.0
184653
def cst_now():
    
    try:
        ret = datetime.utcnow() + timedelta(hours=DEFAULT_TIMEZONE)
        if DEFAULT_TIMEZONE_AWARE:
            ret = ret.replace(
                tzinfo=psycopg2.tz.FixedOffsetTimezone(
                    name=None, offset=DEFAULT_TIMEZONE * 60))
        return ret
    except Exception as ex:
        return datetime.utcnow() + timedelta(hours=DEFAULT_TIMEZONE)
482082
def get(self):
        
        now = datetime.now()
        if self._start_time:
            if self._stop_time:
                return (self._stop_time - self._start_time).total_seconds()
            return (now - self._start_time).total_seconds()
        return 0.
732831
def age(self, now=None):
        
        if not self.time_created:
            return None
        if now is None:
            now = datetime.utcnow()
        return (now - self.time_created).seconds
468935
def get_local_utcoffset():
        
        utc = datetime.utcnow()
        local = datetime.now()
        if local < utc:
            return - int(float((utc - local).seconds) / 60 + .5)
        return int(float((local - utc).seconds) / 60 + .5)
1036761
def previous_time(from=ZoTime.now)

      pt = nil
      zt = ZoTime.new(from.to_i - 1, @timezone)
      miny = from.year - NEXT_TIME_MAX_YEARS

      loop do

        pt = zt.dup

        fail RangeError.new(
          "failed to reach occurrence within " +
            "#{NEXT_TIME_MAX_YEARS} years for '#{original}'"
        ) if pt.year < miny

        unless date_match?(pt)
          zt.substract(pt.hour * 3600 + pt.min * 60 + pt.sec + 1)
          next
        end
        unless sub_match?(pt, :hour, @hours)
          zt.substract(pt.min * 60 + pt.sec + 1)
          next
        end
        unless sub_match?(pt, :min, @minutes)
          zt.substract(pt.sec + 1)
          next
        end
        unless sub_match?(pt, :sec, @seconds)
          zt.substract(prev_second(pt))
          next
        end

        break
      end

      pt
    end
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)
575119
def get_midnight():
    
    limit = now()
    if settings.USE_TZ:
        limit = localtime(limit)
    return limit.replace(hour=0, minute=0, second=0, microsecond=0)
520640
def current_offset(local_tz=None):
    
    if local_tz is None:
        local_tz = DEFAULT_LOCAL_TZ
    dt = local_tz.localize(datetime.now())
    return dt.utcoffset()
95107
def elapsed(self):
        
        if not self.start_date:
            return None
        return (self.end_date or datetime.utcnow()) - self.start_date
1367396
public Instant getNextExecutionTimeAfter(Instant now) {
        OffsetTime timeOfDay = OffsetTime.from(TIME_OF_DAY_FORMAT.parse(getTimeOfDay()));

        // The time of the next run is based on the time past midnight UTC relative to the current time
        Instant nextExecTime = now.atOffset(ZoneOffset.UTC).with(timeOfDay).toInstant();

        // If the first execution would have been for earlier today move to the next execution.
        while (nextExecTime.isBefore(now)) {
            nextExecTime = nextExecTime.plus(Duration.ofDays(1));
        }

        return nextExecTime;
    }
1283013
def nextday(self):
        ''' 
        '''
        nextday = self.__zero.date() + timedelta(days=1)
        return datetime.combine(nextday, time())
1362551
def next_month(today: datetime=None, tz=None):
    
    if today is None:
        today = datetime.utcnow()
    begin = datetime(day=1, month=today.month, year=today.year)
    next_mo = begin + timedelta(days=32)
    begin = datetime(day=1, month=next_mo.month, year=next_mo.year)
    following_mo = begin + timedelta(days=32)
    end = datetime(day=1, month=following_mo.month, year=following_mo.year)
    return localize_time_range(begin, end, tz)
346682
def ttl(self):
        

        # result is self ts
        result = getattr(self, Annotation.__TS, None)
        # if result is not None
        if result is not None:
            # result is now - result
            now = time()
            result = result - now

        return result
147973
def getUTC(self, utcoffset):
        
        newTime = (self.value - utcoffset.value) % 24
        return Time(newTime)