Esempio n. 1
0
 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
     ])
Esempio n. 2
0
 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)
Esempio n. 3
0
 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 ] )
Esempio n. 4
0
 def struct_time(self):
     return _struct_time(self._tfunc(self._intervals_since_epoch * self._isec))
Esempio n. 5
0
 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)
Esempio n. 6
0
 def struct_time(self):
     return _struct_time(
         self._tfunc(self._intervals_since_epoch * self._isec))
Esempio n. 7
0
 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)))