Exemplo n.º 1
0
 def timetuple(self):
     """Return a :class:`time.struct_time` from this date.  DST flag is
     -1"""
     njtm = self.__jtm.copy()
     jalali_update(njtm)
     njtm.tm_isdst = -1
     return jtm_to_struct_time(njtm)
Exemplo n.º 2
0
 def timetuple(self):
     """Return a :class:`time.struct_time` from this date.  DST flag is
     -1"""
     njtm = self.__jtm.copy()
     jalali_update(njtm)
     njtm.tm_isdst = -1
     return jtm_to_struct_time(njtm)
Exemplo n.º 3
0
 def utctimetuple(self):
     if self.tzinfo is None:
         d = self
     else:
         d = self.replace(tzinfo=None) - self.utcoffset()
     njtm = d.jtm.copy()
     jalali_update(njtm)
     return jtm_to_struct_time(njtm)
Exemplo n.º 4
0
 def utctimetuple(self):
     if self.tzinfo is None:
         d = self
     else:
         d = self.replace(tzinfo=None) - self.utcoffset()
     njtm = d.jtm.copy()
     jalali_update(njtm)
     return jtm_to_struct_time(njtm)
Exemplo n.º 5
0
    def timetuple(self):
        """Return a :class:`time.struct_time` from this date. The tm_isdst
        flag of the result is set according to the dst() method: tzinfo is
        None or dst() returns None, tm_isdst is set to -1; else if dst()
        returns a non-zero value, tm_isdst is set to 1; else tm_isdst is set
        to 0."""

        njtm = self.__jtm.copy()
        jalali_update(njtm)
        if self.dst() is None:
            njtm.tm_isdst = -1
        elif self.dst() == 0:
            njtm.tm_isdst = 0
        else:
            njtm.tm_isdst = 1
        return jtm_to_struct_time(njtm)
Exemplo n.º 6
0
    def timetuple(self):
        """Return a :class:`time.struct_time` from this date. The tm_isdst
        flag of the result is set according to the dst() method: tzinfo is
        None or dst() returns None, tm_isdst is set to -1; else if dst()
        returns a non-zero value, tm_isdst is set to 1; else tm_isdst is set
        to 0."""

        njtm = self.__jtm.copy()
        jalali_update(njtm)
        if self.dst() is None:
            njtm.tm_isdst = -1
        elif self.dst() == 0:
            njtm.tm_isdst = 0
        else:
            njtm.tm_isdst = 1
        return jtm_to_struct_time(njtm)
Exemplo n.º 7
0
def datetime_from_jtm(jtm, microsecond=0, tz=None):
    return datetime(*jtm_to_struct_time(jtm)[:6],
                    microsecond=microsecond,
                    tzinfo=tz)
Exemplo n.º 8
0
def datetime_from_jtm(jtm, microsecond=0, tz=None):
    return datetime(*jtm_to_struct_time(jtm)[:6], microsecond=microsecond,
                    tzinfo=tz)