예제 #1
0
파일: stanza.py 프로젝트: 2M1R/SleekXMPP
 def get_utc(self):
     """
     Return the time in UTC as a datetime object.
     """
     value = self._get_sub_text('utc')
     if value == '':
         return xep_0082.parse(xep_0082.datetime())
     return xep_0082.parse('%sZ' % value)
예제 #2
0
 def get_utc(self):
     """
     Return the time in UTC as a datetime object.
     """
     value = self._get_sub_text('utc')
     if value == '':
         return xep_0082.parse(xep_0082.datetime())
     return xep_0082.parse('%sZ' % value)
예제 #3
0
 def get_tzo(self):
     """
     Return the timezone offset from UTC as a tzinfo object.
     """
     tzo = self._get_sub_text('tzo')
     if tzo == '':
         tzo = 'Z'
     time = xep_0082.parse('00:00:00%s' % tzo)
     return time.tzinfo
예제 #4
0
파일: stanza.py 프로젝트: 2M1R/SleekXMPP
 def get_tzo(self):
     """
     Return the timezone offset from UTC as a tzinfo object.
     """
     tzo = self._get_sub_text('tzo')
     if tzo == '':
         tzo = 'Z'
     time = xep_0082.parse('00:00:00%s' % tzo)
     return time.tzinfo
예제 #5
0
    def set_tzo(self, value):
        """
        Set the timezone offset from UTC.

        Arguments:
            value -- Either a tzinfo object or the number of
                     seconds (positive or negative) to offset.
        """
        time = xep_0082.time(offset=value)
        if xep_0082.parse(time).tzinfo == tzutc():
            self._set_sub_text('tzo', 'Z')
        else:
            self._set_sub_text('tzo', time[-6:])
예제 #6
0
    def set_time(self, value):
        """
        Set both the UTC and TZO fields given a time object.

        Arguments:
            value -- A datetime object or properly formatted
                     string equivalent.
        """
        date = value
        if not isinstance(value, dt.datetime):
            date = xep_0082.parse(value)
        self['utc'] = date
        self['tzo'] = date.tzinfo
예제 #7
0
파일: stanza.py 프로젝트: 2M1R/SleekXMPP
    def set_tzo(self, value):
        """
        Set the timezone offset from UTC.

        Arguments:
            value -- Either a tzinfo object or the number of
                     seconds (positive or negative) to offset.
        """
        time = xep_0082.time(offset=value)
        if xep_0082.parse(time).tzinfo == tzutc():
            self._set_sub_text('tzo', 'Z')
        else:
            self._set_sub_text('tzo', time[-6:])
예제 #8
0
파일: stanza.py 프로젝트: 2M1R/SleekXMPP
    def set_time(self, value):
        """
        Set both the UTC and TZO fields given a time object.

        Arguments:
            value -- A datetime object or properly formatted
                     string equivalent.
        """
        date = value
        if not isinstance(value, dt.datetime):
            date = xep_0082.parse(value)
        self['utc'] = date
        self['tzo'] = date.tzinfo
예제 #9
0
    def set_utc(self, value):
        """
        Set the time in UTC.

        Arguments:
            value -- A datetime object or properly formatted
                     string equivalent.
        """
        date = value
        if not isinstance(value, dt.datetime):
            date = xep_0082.parse(value)
        date = date.astimezone(tzutc())
        value = xep_0082.format_datetime(date)[:-1]
        self._set_sub_text('utc', value)
예제 #10
0
파일: stanza.py 프로젝트: 2M1R/SleekXMPP
    def set_utc(self, value):
        """
        Set the time in UTC.

        Arguments:
            value -- A datetime object or properly formatted
                     string equivalent.
        """
        date = value
        if not isinstance(value, dt.datetime):
            date = xep_0082.parse(value)
        date = date.astimezone(tzutc())
        value = xep_0082.format_datetime(date)[:-1]
        self._set_sub_text('utc', value)
예제 #11
0
 def get_stamp(self):
     timestamp = self._get_attr('stamp')
     return xep_0082.parse('%sZ' % timestamp)
예제 #12
0
파일: stanza.py 프로젝트: E-Tahta/sleekxmpp
 def get_end(self):
     timestamp = self._get_sub_text('end')
     return xep_0082.parse(timestamp)
예제 #13
0
 def get_tz(self):
     if not self.xml.text:
         return xep_0082.tzutc()
     time = xep_0082.parse('00:00:00%s' % self.xml.text)
     return time.tzinfo
예제 #14
0
파일: stanza.py 프로젝트: Stiveknx/emesene
 def get_tz(self):
     if not self.xml.text:
         return xep_0082.tzutc()
     time = xep_0082.parse('00:00:00%s' % self.xml.text)
     return time.tzinfo
예제 #15
0
파일: stanza.py 프로젝트: Stiveknx/emesene
 def get_rev(self):
     if not self.xml.text:
         return None
     return xep_0082.parse(self.xml.text)
예제 #16
0
 def get_expiry(self):
     expiry = self._get_attr('expiry')
     if expiry.lower() == 'presence':
         return expiry
     return xep_0082.parse(expiry)
예제 #17
0
 def get_rev(self):
     if not self.xml.text:
         return None
     return xep_0082.parse(self.xml.text)
예제 #18
0
파일: stanza.py 프로젝트: E-Tahta/sleekxmpp
 def get_since(self):
     timestamp = self._get_attr('since')
     return xep_0082.parse(timestamp)
예제 #19
0
파일: stanza.py 프로젝트: E-Tahta/sleekxmpp
 def get_start(self):
     timestamp = self._get_sub_text('start')
     return xep_0082.parse(timestamp)
예제 #20
0
 def get_stamp(self):
     timestamp = self._get_attr('stamp')
     return xep_0082.parse(timestamp) if timestamp else None
예제 #21
0
 def get_expiry(self):
     expiry = self._get_attr('expiry')
     if expiry.lower() == 'presence':
         return expiry
     return xep_0082.parse(expiry)
예제 #22
0
 def get_date(self):
     timestamp = self._get_attr('date')
     return xep_0082.parse(timestamp)