Public Member Functions | |
def | __init__ |
def | time |
def | inc |
def | __eq__ |
def | __ne__ |
def | __lt__ |
def | __le__ |
def | __gt__ |
def | __ge__ |
def | __repr__ |
def | as_datetime |
MongoDB internal timestamps used in the opLog.
def bson.timestamp.Timestamp.__init__ | ( | self, | |
time, | |||
inc | |||
) |
Create a new :class:`Timestamp`. This class is only for use with the MongoDB opLog. If you need to store a regular timestamp, please use a :class:`~datetime.datetime`. Raises :class:`TypeError` if `time` is not an instance of :class: `int` or :class:`~datetime.datetime`, or `inc` is not an instance of :class:`int`. Raises :class:`ValueError` if `time` or `inc` is not in [0, 2**32). :Parameters: - `time`: time in seconds since epoch UTC, or a naive UTC :class:`~datetime.datetime`, or an aware :class:`~datetime.datetime` - `inc`: the incrementing counter .. versionchanged:: 1.7 `time` can now be a :class:`~datetime.datetime` instance.
def bson.timestamp.Timestamp.as_datetime | ( | self | ) |
Return a :class:`~datetime.datetime` instance corresponding to the time portion of this :class:`Timestamp`. .. versionchanged:: 1.8 The returned datetime is now timezone aware.
def bson.timestamp.Timestamp.inc | ( | self | ) |
Get the inc portion of this :class:`Timestamp`.
def bson.timestamp.Timestamp.time | ( | self | ) |
Get the time portion of this :class:`Timestamp`.