18.2.3.21.6. Time_t

class Time_t

Structure Time_t, used to describe times at RTPS protocol.

Public Functions

Time_t() = default

Default constructor. Sets values to zero.

Time_t(int32_t sec, uint32_t frac)
Parameters
  • sec – Seconds

  • frac – Fraction of second

Time_t(long double sec)
Parameters

sec – Seconds. The fractional part is converted to nanoseconds.

Time_t(const eprosima::fastrtps::Time_t &time)
Parameters

timefastrtps::Time_t, aka. Duration_t.

int64_t to_ns() const

Returns stored time as nanoseconds (including seconds)

void from_ns(int64_t nanosecs)
Parameters

nanosecs – Stores given time as nanoseconds (including seconds)

int32_t seconds() const

Retrieve the seconds field.

int32_t &seconds()

Retrieve the seconds field by ref.

void seconds(int32_t sec)

Sets seconds field.

uint32_t nanosec() const

Retrieve the nanosec field.

void nanosec(uint32_t nanos)

Sets nanoseconds field and updates the fraction.

uint32_t fraction() const

Retrieve the fraction field.

uint32_t &fraction()

Retrieve the fraction field by ref.

void fraction(uint32_t frac)

Sets fraction field and updates the nanoseconds.

Public Static Functions

static void now(Time_t &ret)

Fills a Time_t struct with a representation of the current time.

Parameters

ret – Reference to the structure to be filled in.