OpenQuizz
Une application de gestion des contenus pédagogiques
Timestamp Class Reference
Inheritance diagram for Timestamp:
Collaboration diagram for Timestamp:

Public Member Functions

def __init__ (self, time, inc)
 
def time (self)
 
def inc (self)
 
def __eq__ (self, other)
 
def __hash__ (self)
 
def __ne__ (self, other)
 
def __lt__ (self, other)
 
def __le__ (self, other)
 
def __gt__ (self, other)
 
def __ge__ (self, other)
 
def __repr__ (self)
 
def as_datetime (self)
 

Detailed Description

MongoDB internal timestamps used in the opLog.

Constructor & Destructor Documentation

◆ __init__()

def __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

Member Function Documentation

◆ __eq__()

def __eq__ (   self,
  other 
)

◆ __ge__()

def __ge__ (   self,
  other 
)

◆ __gt__()

def __gt__ (   self,
  other 
)

◆ __hash__()

def __hash__ (   self)

◆ __le__()

def __le__ (   self,
  other 
)

◆ __lt__()

def __lt__ (   self,
  other 
)

◆ __ne__()

def __ne__ (   self,
  other 
)

◆ __repr__()

def __repr__ (   self)

◆ as_datetime()

def as_datetime (   self)
Return a :class:`~datetime.datetime` instance corresponding
to the time portion of this :class:`Timestamp`.

The returned datetime's timezone is UTC.

◆ inc()

def inc (   self)
Get the inc portion of this :class:`Timestamp`.

◆ time()

def time (   self)
Get the time portion of this :class:`Timestamp`.

The documentation for this class was generated from the following file: