Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
pip._vendor.msgpack.ext.Timestamp Class Reference
Inheritance diagram for pip._vendor.msgpack.ext.Timestamp:
Inheritance graph
[legend]
Collaboration diagram for pip._vendor.msgpack.ext.Timestamp:
Collaboration graph
[legend]

Public Member Functions

 __init__ (self, seconds, nanoseconds=0)
 
 __repr__ (self)
 
 __eq__ (self, other)
 
 __ne__ (self, other)
 
 __hash__ (self)
 
 to_bytes (self)
 
 to_unix (self)
 
 to_unix_nano (self)
 
 to_datetime (self)
 

Static Public Member Functions

 from_bytes (b)
 
 from_unix (unix_sec)
 
 from_unix_nano (unix_ns)
 
 from_datetime (dt)
 

Public Attributes

 seconds
 
 nanoseconds
 

Detailed Description

Timestamp represents the Timestamp extension type in msgpack.

When built with Cython, msgpack uses C methods to pack and unpack `Timestamp`. When using pure-Python
msgpack, :func:`to_bytes` and :func:`from_bytes` are used to pack and unpack `Timestamp`.

This class is immutable: Do not override seconds and nanoseconds.

Constructor & Destructor Documentation

◆ __init__()

pip._vendor.msgpack.ext.Timestamp.__init__ (   self,
  seconds,
  nanoseconds = 0 
)
Initialize a Timestamp object.

:param int seconds:
    Number of seconds since the UNIX epoch (00:00:00 UTC Jan 1 1970, minus leap seconds).
    May be negative.

:param int nanoseconds:
    Number of nanoseconds to add to `seconds` to get fractional time.
    Maximum is 999_999_999.  Default is 0.

Note: Negative times (before the UNIX epoch) are represented as negative seconds + positive ns.

Member Function Documentation

◆ __eq__()

pip._vendor.msgpack.ext.Timestamp.__eq__ (   self,
  other 
)
Check for equality with another Timestamp object

◆ __ne__()

pip._vendor.msgpack.ext.Timestamp.__ne__ (   self,
  other 
)
not-equals method (see :func:`__eq__()`)

◆ __repr__()

pip._vendor.msgpack.ext.Timestamp.__repr__ (   self)
String representation of Timestamp.

◆ from_bytes()

pip._vendor.msgpack.ext.Timestamp.from_bytes (   b)
static
Unpack bytes into a `Timestamp` object.

Used for pure-Python msgpack unpacking.

:param b: Payload from msgpack ext message with code -1
:type b: bytes

:returns: Timestamp object unpacked from msgpack ext payload
:rtype: Timestamp

◆ from_datetime()

pip._vendor.msgpack.ext.Timestamp.from_datetime (   dt)
static
Create a Timestamp from datetime with tzinfo.

Python 2 is not supported.

:rtype: Timestamp

◆ from_unix()

pip._vendor.msgpack.ext.Timestamp.from_unix (   unix_sec)
static
Create a Timestamp from posix timestamp in seconds.

:param unix_float: Posix timestamp in seconds.
:type unix_float: int or float.

◆ from_unix_nano()

pip._vendor.msgpack.ext.Timestamp.from_unix_nano (   unix_ns)
static
Create a Timestamp from posix timestamp in nanoseconds.

:param int unix_ns: Posix timestamp in nanoseconds.
:rtype: Timestamp

◆ to_bytes()

pip._vendor.msgpack.ext.Timestamp.to_bytes (   self)
Pack this Timestamp object into bytes.

Used for pure-Python msgpack packing.

:returns data: Payload for EXT message with code -1 (timestamp type)
:rtype: bytes

◆ to_datetime()

pip._vendor.msgpack.ext.Timestamp.to_datetime (   self)
Get the timestamp as a UTC datetime.

Python 2 is not supported.

:rtype: datetime.

◆ to_unix()

pip._vendor.msgpack.ext.Timestamp.to_unix (   self)
Get the timestamp as a floating-point value.

:returns: posix timestamp
:rtype: float

◆ to_unix_nano()

pip._vendor.msgpack.ext.Timestamp.to_unix_nano (   self)
Get the timestamp as a unixtime in nanoseconds.

:returns: posix timestamp in nanoseconds
:rtype: int

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