libcamera  v0.3.1+12-19bbca3c
Supporting cameras in Linux since 2019
Public Member Functions | List of all members
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:
Inheritance graph
[legend]
Collaboration diagram for libcamera::utils::Duration:
Collaboration graph
[legend]

Public Member Functions

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

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)
inlineexplicit

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)
inline

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 >
libcamera::utils::Duration::get< Period > ( ) 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:

utils::Duration d = 5s;
double d_in_ms = d.get<std::milli>();
Returns
The tick count of the Duration expressed in Period

◆ operator bool()

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

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: