NVIDIA Holoscan SDK v3.6.1

Class Clock

Base Type

class Clock : public holoscan::Resource

Clock resource class using Bridge pattern.

Clock classes are used by a Scheduler to control the flow of time in an application. This class acts as a Resource wrapper around a ClockInterface implementation.

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 Clock(ArgT &&arg, ArgsT&&... args)
Clock() = default
inline explicit Clock(std::shared_ptr<ClockInterface> clock_impl)

Constructor that takes a clock implementation.

~Clock() override = default
inline void set_clock_impl(std::shared_ptr<ClockInterface> clock_impl)

Set the clock implementation.

inline std::shared_ptr<ClockInterface> clock_impl() const

Get the clock implementation.

template<typename T>
inline std::shared_ptr<T> cast_to() const

Template method for safe casting to specific clock implementation types.

inline virtual double time() const

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

inline virtual int64_t timestamp() const

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

inline virtual void sleep_for(int64_t duration_ns)

Waits until the given duration has elapsed on the clock.

template<typename Rep, typename Period>
inline void sleep_for(std::chrono::duration<Rep, Period> duration)

Set a duration to sleep.

Parameters

duration – The sleep duration of type std::chrono::duration.

inline virtual void sleep_until(int64_t target_time_ns)

Waits until the given target time.

Protected Attributes

std::shared_ptr<ClockInterface> clock_impl_

The clock implementation.

Previous Class CLIParser
Next Class ClockInterface
© Copyright 2022-2025, NVIDIA. Last updated on Sep 16, 2025.