datetime.time -> SubRipTime corresponding to time object
354125
def from_time(cls, source):
        
        return cls(hours=source.hour, minutes=source.minute,
            seconds=source.second, milliseconds=source.microsecond // 1000)
983747
def parse_time(val):
    
    dt = parse_date(val)
    if dt.tzinfo is None:
        return dt.time()
    return datetime.time(dt.hour, dt.minute, dt.second, dt.microsecond, dt.tzinfo)
1089636
def asStructTime(self, tzinfo=None):
        
        dtime = self.asDatetime(tzinfo)
        if tzinfo is None:
            return dtime.utctimetuple()
        else:
            return dtime.timetuple()
569167
def time_to_datetime(x):
    """"""
    if isinstance(x, time):
        return datetime.combine(date(1970, 1, 1), x)
    return x
866097
def convertTime(self, frametime, which):
        """"""
        SubAssert(frametime.frame >= 0, _("Negative time present."))
        return frametime.frame
885857
def current_time(self) -> datetime:
        """"""
        _date = datetime.strptime(self.obj.SBRes.SBReq.StartT.get("date"), "%Y%m%d")
        _time = datetime.strptime(self.obj.SBRes.SBReq.StartT.get("time"), "%H:%M")
        return datetime.combine(_date.date(), _time.time())
1023748
def str_to_time(self):
        

        return datetime(*list(map(int, re.split(r'-|:|T', self.time))))
1216892
def _convert_time(self, time_str):
        
        dt = datetime.strptime(time_str, "%Y-%m-%dT%H:%M:%SZ")
        return int(time.mktime(dt.utctimetuple()))
584920
def datetimes(self):
        """"""
        if self.timestep == 1:
            return tuple(dt.add_minute(30) for dt in
                         self.direct_normal_irradiance.datetimes)
        else:
            return self.direct_normal_irradiance.datetimes
866616
def default(self, obj, **kwargs):
        """"""
        if isinstance(obj, datetime.datetime):
            return time.mktime(obj.timetuple())

        if isinstance(obj, Timestamp):
            return obj.time

        if isinstance(obj, ObjectId):
            return obj.__str__()

        return JSONEncoder.default(self, obj)
894760
def seconds2time(s):
    """"""
    hour, temp = divmod(s, 3600)
    minute, temp = divmod(temp, 60)
    temp, second = math.modf(temp)
    return datetime.time(hour=int(hour), minute=int(minute), second=int(second),
                         microsecond=int(round(temp * 1e6)))
206981
def clean_time(self, time):
        
        if isinstance(time, int):
            time = datetime.utcfromtimestamp(time)
        elif isinstance(time, str):
            time = parser.parse(time)

        return time
6273
def asn1_generaltime_to_seconds(timestr):
    
    res = None
    timeformat = "%Y%m%d%H%M%S"
    try:
        res = datetime.strptime(timestr, timeformat + 'Z')
    except ValueError:
        try:
            res = datetime.strptime(timestr, timeformat + '%z')
        except ValueError:
            pass
    return res
239107
def datetime2gtd(time: Union[str, datetime.datetime, np.datetime64],
                 glon: Union[float, List[float], np.ndarray] = np.nan) -> Tuple[int, float, float]:
    
# %%
    T = np.atleast_1d(time)
    glon = np.asarray(glon)
    doy = np.empty_like(T, int)
    utsec = np.empty_like(T, float)
    stl = np.empty((T.size, *glon.shape))

    for i, t in enumerate(T):
        if isinstance(t, str):
            t = parse(t)
        elif isinstance(t, np.datetime64):
            t = t.astype(datetime.datetime)
        elif isinstance(t, (datetime.datetime, datetime.date)):
            pass
        else:
            raise TypeError('unknown time datatype {}'.format(type(t)))
# %% Day of year
        doy[i] = int(t.strftime('%j'))
# %% seconds since utc midnight
        utsec[i] = datetime2utsec(t)

        stl[i, ...] = utsec[i] / 3600. + glon / 15.

    return doy, utsec, stl
811090
function asUtcTime(time) {
      var date = dateBase(time);
      if (!date.getTime()) return NaN;
      return Date.UTC(
        date.getFullYear(), date.getMonth(), date.getDate(),
        date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()
      );
    }
1150486
def time(self):
        

        def format_response(value):
            """Format a TIME response into a datetime.datetime

            :param list value: TIME response is a list of the number
                of seconds since the epoch and the number of micros
                as two byte strings
            :rtype: float

            """
            seconds, micros = value
            return float(seconds) + (float(micros) / 1000000.0)

        return self._execute([b'TIME'], format_callback=format_response)
1314472
def time_in_range(self):
        """"""
        curr = datetime.datetime.now().time()
        if self.start_time <= self.end_time:
            return self.start_time <= curr <= self.end_time
        else:
            return self.start_time <= curr or curr <= self.end_time