def from_stream(cls, stream, offset=None, byte_order=LITTLE_ENDIAN): """Creates a ``datetime`` object from a stream. :type stream: :class:`lf.dec.IStream` :param stream: A stream that contains the Variant timestamp. :type offset: ``int`` or ``None`` :param offset: The start of the Variant timestamp in the stream. :type byte_order: constant :param byte_order: The byte order to use (from :mod:`lf.dtypes`) :raises ValueError: If the Variant timestamp is invalid. :rtype: ``datetime`` :returns: The corresponding ``datetime`` object. """ if offset is not None: stream.seek(offset, SEEK_SET) # end if if byte_order == LITTLE_ENDIAN: vtime = float64_le.from_buffer_copy(stream.read(8)).value else: vtime = float64_be.from_buffer_copy(stream.read(8)).value # end if return cls.from_float(vtime)
def float64_be(self, offset=None): """Reads a 64-bit floating point number (big endian). :type offset: :class:`int` or :keyword:`None` :param offset: The start of the floating point number. :except ValueError: if :attr:`stream` (starting at :attr:`offset` is too small.) :rtype: :class:`float` :returns: The corresponding value. """ if offset is not None: self.stream.seek(offset, SEEK_SET) # end if return float64_be.from_buffer_copy(self.stream.read(8)).value