def _to_struct_time(obj): return _struct_time([ obj.ctime_struct.tm_year + BASE_YR, obj.ctime_struct.tm_mon + 1, obj.ctime_struct.tm_mday, obj.ctime_struct.tm_hour, obj.ctime_struct.tm_min, obj.ctime_struct.tm_sec, obj.ctime_struct.tm_wday + 1, obj.ctime_struct.tm_yday + 1, obj.ctime_struct.tm_isdst ])
def _intervals_since_epoch(self, second, minute, hour, day, month, year): is_dst = self._tfunc().tm_isdst sfe = _mktime( _struct_time( [year, month, day, hour, minute, second, 0, 0, is_dst])) if sfe % self._isec: raise TOSDB_Error("invalid interval constructed") return int(sfe // self._isec)
def _to_struct_time( obj ): return _struct_time( [ obj.ctime_struct.tm_year + BASE_YR, obj.ctime_struct.tm_mon +1, obj.ctime_struct.tm_mday, obj.ctime_struct.tm_hour, obj.ctime_struct.tm_min, obj.ctime_struct.tm_sec, obj.ctime_struct.tm_wday + 1, obj.ctime_struct.tm_yday + 1, obj.ctime_struct.tm_isdst ] )
def struct_time(self): return _struct_time(self._tfunc(self._intervals_since_epoch * self._isec))
def _intervals_since_epoch(self, second, minute, hour, day, month, year): is_dst = self._tfunc().tm_isdst sfe = _mktime(_struct_time([year,month,day,hour,minute,second,0,0,is_dst])) if sfe % self._isec: raise TOSDB_Error("invalid interval constructed") return int(sfe // self._isec)
def struct_time(self): return _struct_time( self._tfunc(self._intervals_since_epoch * self._isec))
def __init__(self, day, month, year, hour: int, minute: int, second: int): self.seconds = _time.mktime( _struct_time((year, month, day, hour, minute, second, -1, -1, -1)))