Safe DDS
eprosima::safedds::execution::TimePoint Struct Reference

TimePoint represents a moment in time with nanoseconds precision. More...

#include <TimePoint.hpp>

Public Member Functions

constexpr int64_t to_ms () const noexcept
 To milliseconds conversion. More...
 
constexpr int64_t to_us () const noexcept
 To microseconds conversion. More...
 
TimePoint normalize () const noexcept
 Normalize the TimePoint to handle nanoseconds overflow. More...
 

Static Public Member Functions

static constexpr TimePoint from_ms (uint64_t ms) noexcept
 Create a TimePoint from milliseconds. More...
 
static constexpr TimePoint from_us (uint64_t us) noexcept
 Create a TimePoint from microseconds. More...
 
static TimePoint min (const TimePoint &first, const TimePoint &second) noexcept
 Static min operator. More...
 

Public Attributes

int32_t seconds
 Seconds since UNIX prime epoch (0h, 1 January 1970). More...
 
uint32_t nanoseconds
 Nanoseconds. More...
 

Static Public Attributes

static constexpr uint32_t CDR_SERIALIZED_SIZE
 CDR serialized size. More...
 

Detailed Description

TimePoint represents a moment in time with nanoseconds precision.

@safety_api_struct

Member Function Documentation

◆ from_ms()

static constexpr TimePoint eprosima::safedds::execution::TimePoint::from_ms ( uint64_t  ms)
inlinestaticconstexprnoexcept

Create a TimePoint from milliseconds.

Parameters
msMilliseconds.
Returns
TimePoint with the given milliseconds.

◆ from_us()

static constexpr TimePoint eprosima::safedds::execution::TimePoint::from_us ( uint64_t  us)
inlinestaticconstexprnoexcept

Create a TimePoint from microseconds.

Parameters
usMicroseconds.
Returns
TimePoint with the given microseconds.

◆ min()

static TimePoint eprosima::safedds::execution::TimePoint::min ( const TimePoint first,
const TimePoint second 
)
staticnoexcept

Static min operator.

Parameters
firstLeft hand side of the operator
secondRight hand side of the operator
Returns
The minimum of both timepoints

◆ normalize()

TimePoint eprosima::safedds::execution::TimePoint::normalize ( ) const
noexcept

Normalize the TimePoint to handle nanoseconds overflow.

Note
This method handles negative TimePoints as TIME_INVALID.
This method handles TimePoints greater than TIME_MAX_REPRESENTABLE as TIME_INFINITE.
Returns
Normalized TimePoint.

◆ to_ms()

constexpr int64_t eprosima::safedds::execution::TimePoint::to_ms ( ) const
inlineconstexprnoexcept

To milliseconds conversion.

Returns
Milliseconds in a 64-bit integer.

◆ to_us()

constexpr int64_t eprosima::safedds::execution::TimePoint::to_us ( ) const
inlineconstexprnoexcept

To microseconds conversion.

Returns
Microseconds in a 64-bit integer.

Member Data Documentation

◆ CDR_SERIALIZED_SIZE

constexpr uint32_t eprosima::safedds::execution::TimePoint::CDR_SERIALIZED_SIZE
staticconstexpr
Initial value:
=
portable::safe_sizeof<int32_t>() +
portable::safe_sizeof<uint32_t>()

CDR serialized size.

◆ nanoseconds

uint32_t eprosima::safedds::execution::TimePoint::nanoseconds

Nanoseconds.

◆ seconds

int32_t eprosima::safedds::execution::TimePoint::seconds

Seconds since UNIX prime epoch (0h, 1 January 1970).


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