Class time_stamp_t
Defined in File time_stamp.hpp
Class Documentation
-
class time_stamp_t
A simple class to represent a time stamp. It is a wrapper around a uint64_t value, which represents the time in microseconds since the epoch.
Public Types
-
using vector = std::vector<time_stamp_t>
Typedef for a vector of time stamps.
Public Functions
-
inline time_stamp_t()
Default constructor, initializes the time stamp to the unset value.
-
inline time_stamp_t(const uint64_t &time_)
Construct a new time_stamp_t object from a uint64_t value
- Parameters:
time_ – Timestamp value in microseconds since epoch.
-
inline time_stamp_t operator=(const uint64_t &other_)
Assignment operator from a uint64_t value
- Parameters:
other_ – New timestamp value in microseconds.
- Returns:
Updated timestamp object.
-
inline bool operator==(const time_stamp_t &other_) const
Comparison operators
- Parameters:
other_ – Timestamp to compare against this instance.
- Returns:
truewhen both timestamps store the same value.
-
inline bool operator!=(const time_stamp_t &other_) const
Comparison operators
- Parameters:
other_ – Timestamp to compare against this instance.
- Returns:
truewhen timestamp values differ.
-
inline bool operator<(const time_stamp_t &other_) const
Comparison operators
- Parameters:
other_ – Timestamp to compare against this instance.
- Returns:
truewhen this timestamp is earlier thanother_.
-
inline bool operator<=(const time_stamp_t &other_) const
Comparison operators
- Parameters:
other_ – Timestamp to compare against this instance.
- Returns:
truewhen this timestamp is earlier than or equal toother_.
-
inline bool operator>=(const time_stamp_t &other_) const
Comparison operators
- Parameters:
other_ – Timestamp to compare against this instance.
- Returns:
truewhen this timestamp is later than or equal toother_.
-
inline bool operator>(const time_stamp_t &other_) const
Comparison operators
- Parameters:
other_ – Timestamp to compare against this instance.
- Returns:
truewhen this timestamp is later thanother_.
-
inline std::string to_string() const
Convert the time stamp to a string representation
- Returns:
Decimal string representation of the timestamp value.
-
inline uint64_t get() const
Get the time value of the time stamp
- Returns:
Stored timestamp value in microseconds.
-
inline bool is_unset() const
Check if the time stamp is unset (i.e., has the UNSET value)
- Returns:
truewhen the timestamp equalsUNSET,falseotherwise.
Public Static Functions
-
static inline uint64_t distance(const time_stamp_t &t1_, const time_stamp_t &t2_)
Static function to compute the distance between two time stamps
- Parameters:
t1_ – First timestamp in the distance computation.
t2_ – Second timestamp in the distance computation.
- Returns:
Absolute difference between
t1_andt2_in microseconds.
Public Static Attributes
-
static constexpr uint64_t UNSET = std::numeric_limits<uint64_t>::max()
A constant value representing an unset time stamp It is used as a sentinel for missing or invalid timestamps.
Private Members
-
uint64_t time
The time value of the time stamp.
Friends
-
inline friend std::ostream &operator<<(std::ostream &os_, const time_stamp_t &t_)
Output stream operator for time_stamp_t
- Parameters:
os_ – Output stream receiving the formatted timestamp.
t_ – Timestamp instance that will be written to
os_.
- Returns:
Reference to
os_for stream chaining.
-
using vector = std::vector<time_stamp_t>