libcamera v0.5.1
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
libcamera::utils::Duration Class Reference

Helper class from std::chrono::duration that represents a time duration in nanoseconds with double precision. More...

Inheritance diagram for libcamera::utils::Duration:
Collaboration diagram for libcamera::utils::Duration:

Public Member Functions

template<typename Rep>
constexpr Duration (const Rep &r)
 Construct a Duration with r ticks.
template<typename Rep, typename Period>
constexpr Duration (const std::chrono::duration< Rep, Period > &d)
 Construct a Duration by converting an arbitrary std::chrono::duration.
template<typename Period>
double get () const
 Retrieve the tick count, converted to the timebase provided by the template argument Period of type std::ratio.
constexpr operator bool () const
 Boolean operator to test if a Duration holds a non-zero time value.

Detailed Description

Helper class from std::chrono::duration that represents a time duration in nanoseconds with double precision.

Constructor & Destructor Documentation

◆ Duration() [1/2]

template<typename Rep>
libcamera::utils::Duration::Duration ( const Rep & r)
inlineexplicitconstexpr

Construct a Duration with r ticks.

Parameters
[in]rThe number of ticks

The constructed Duration object is internally represented in double precision with r nanoseconds ticks.

◆ Duration() [2/2]

template<typename Rep, typename Period>
libcamera::utils::Duration::Duration ( const std::chrono::duration< Rep, Period > & d)
inlineconstexpr

Construct a Duration by converting an arbitrary std::chrono::duration.

Parameters
[in]dThe std::chrono::duration object to convert from

The constructed Duration object is internally represented in double precision with nanoseconds ticks.

Member Function Documentation

◆ get()

template<typename Period>
double libcamera::utils::Duration::get ( ) const
inline

Retrieve the tick count, converted to the timebase provided by the template argument Period of type std::ratio.

A typical usage example is given below:

double d_in_ms = d.get<std::milli>();
Helper class from std::chrono::duration that represents a time duration in nanoseconds with double pr...
Definition utils.h:371
double get() const
Retrieve the tick count, converted to the timebase provided by the template argument Period of type s...
Definition utils.h:390
Returns
The tick count of the Duration expressed in Period

◆ operator bool()

libcamera::utils::Duration::operator bool ( ) const
inlineexplicitconstexpr

Boolean operator to test if a Duration holds a non-zero time value.

Returns
True if Duration is a non-zero time value, False otherwise

The documentation for this class was generated from the following files:
  • include/libcamera/base/utils.h
  • src/libcamera/base/utils.cpp