Leka
A low-latency C++20 price-time-priority limit order book and matching engine
▶ Replay viewer
Loading...
Searching...
No Matches
lob::Timestamp Class Reference

Nanoseconds since the Unix epoch; zero is reserved as invalid. More...

#include <timestamp.hpp>

Public Member Functions

 Timestamp ()
 Constructs an invalid, zero-valued timestamp.
 Timestamp (std::uint64_t timestamp)
 Constructs a timestamp from nanoseconds since the Unix epoch.
std::uint64_t getTimestamp () const
 Returns nanoseconds since the Unix epoch.
bool isValid () const
 Returns whether the timestamp is nonzero.
auto operator<=> (const Timestamp &other) const =default
 Compares timestamps chronologically.

Detailed Description

Nanoseconds since the Unix epoch; zero is reserved as invalid.

Definition at line 10 of file timestamp.hpp.

Constructor & Destructor Documentation

◆ Timestamp() [1/2]

lob::Timestamp::Timestamp ( )
inline

Constructs an invalid, zero-valued timestamp.

Definition at line 16 of file timestamp.hpp.

Referenced by operator<=>().

◆ Timestamp() [2/2]

lob::Timestamp::Timestamp ( std::uint64_t timestamp)
inlineexplicit

Constructs a timestamp from nanoseconds since the Unix epoch.

Definition at line 19 of file timestamp.hpp.

Member Function Documentation

◆ getTimestamp()

std::uint64_t lob::Timestamp::getTimestamp ( ) const
inline

Returns nanoseconds since the Unix epoch.

Definition at line 22 of file timestamp.hpp.

◆ isValid()

bool lob::Timestamp::isValid ( ) const
inline

Returns whether the timestamp is nonzero.

Definition at line 25 of file timestamp.hpp.

◆ operator<=>()

auto lob::Timestamp::operator<=> ( const Timestamp & other) const
default

Compares timestamps chronologically.

References Timestamp().


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