Ejemplo n.º 1
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)
 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)
Ejemplo n.º 3
0
 def get_timestamp(self):
     """
     Return the value of the <timestamp> element as a DateTime.
     """
     p = self._get_sub_text('timestamp')
     if not p:
         return None
     else:
         return xep_0082.datetime(p)
Ejemplo n.º 4
0
    def set_timestamp(self, timestamp):
        """
        Set the value of the <timestamp> element.

        :param timestamp: UTC timestamp specifying the moment when
                          the reading was taken
        """
        self._set_sub_text('timestamp', text=str(xep_0082.datetime(timestamp)))
        return self
Ejemplo n.º 5
0
 def get_timestamp(self):
     """
     Return the value of the <timestamp> element as a DateTime.
     """
     p = self._get_sub_text('timestamp')
     if not p:
         return None
     else:
         return xep_0082.datetime(p)
Ejemplo n.º 6
0
    def set_timestamp(self, timestamp):
        """
        Set the value of the <timestamp> element.

        Arguments:
            timestamp -- UTC timestamp specifying the moment when
                         the reading was taken
        """
        self._set_sub_text('timestamp', text=str(xep_0082.datetime(timestamp)))
        return self
Ejemplo n.º 7
0
 def default_local_time(jid):
     return xep_0082.datetime(offset=self.tz_offset)
Ejemplo n.º 8
0
 def default_local_time(jid):
     return xep_0082.datetime(offset=self.tz_offset)