libcamera: libcamera::utils::Duration Class Reference

libcamera v0.7.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:
[legend]
Collaboration diagram for libcamera::utils::Duration:
[legend]

## 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 Duration | operator- () const
| Negation operator to negate a Duration.
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] | r | The 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] | d | The 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:

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

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

## ◆ operator-()

Duration libcamera::utils::Duration::operator- | ( |  | ) | const
| inlineconstexpr

Negation operator to negate a Duration.

Returns
  The duration, with the number of ticks negated

The documentation for this class was generated from the following files:

- include/libcamera/base/utils.h
- src/libcamera/base/utils.cpp