What can I help you with?
NVIDIA Holoscan SDK v3.3.0

Class RealtimeClock

class RealtimeClock : public holoscan::Clock

Real-time clock class.

The RealtimeClock respects the true duration of conditions such as PeriodicCondition. It is the default clock type used in Holoscan SDK.

==Parameters==

  • initial_time_offset (double): The initial time offset (in seconds) used until the time scale is changed manually (default: 0.0).

  • initial_time_scale (double): The initial time scale used until the time scale is changed manually (default: 1.0).

  • use_time_since_epoch_ (bool): If true, clock time is the time since epoch + initial_time_offset. Otherwise the clock time starts at initial_time_offset during initialize().

Public Functions

template<typename ArgT, typename ...ArgsT, typename = std::enable_if_t<!std::is_base_of_v<::holoscan::Resource, std::decay_t<ArgT>> && (std::is_same_v<::holoscan::Arg, std::decay_t<ArgT>> || std::is_same_v<::holoscan::ArgList, std::decay_t<ArgT>>)>>
inline explicit RealtimeClock(ArgT &&arg, ArgsT&&... args)
RealtimeClock() = default
RealtimeClock(const std::string &name, nvidia::gxf::RealtimeClock *component)
inline virtual const char *gxf_typename() const override

The underlying GXF component’s name.

virtual void setup(ComponentSpec &spec)

Define the resource specification.

Parameters

spec – The reference to the component specification.

virtual double time() const override

The current time of the clock. Time is measured in seconds.

virtual int64_t timestamp() const override

The current timestamp of the clock. Timestamps are measured in nanoseconds.

virtual void sleep_for(int64_t duration_ns) override

Waits until the given duration has elapsed on the clock.

virtual void sleep_until(int64_t target_time_ns) override

Waits until the given target time.

void set_time_scale(double time_scale)

Set the time scale of the clock. A value of 1.0 corresponds to realtime. Values larger than 1.0 cause time to run faster, while values less than 1.0 cause time to run more slowly.

nvidia::gxf::RealtimeClock *get() const

Previous Class PeriodicCondition
Next Class Receiver
© Copyright 2022-2025, NVIDIA. Last updated on May 29, 2025.