diff options
-rw-r--r-- | include/libcamera/base/utils.h | 6 | ||||
-rw-r--r-- | src/libcamera/base/utils.cpp | 9 |
2 files changed, 15 insertions, 0 deletions
diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h index 9ab18101..cfff0583 100644 --- a/include/libcamera/base/utils.h +++ b/include/libcamera/base/utils.h @@ -327,6 +327,12 @@ class Duration : public std::chrono::duration<double, std::nano> public: Duration() = default; + template<typename Rep> + constexpr explicit Duration(const Rep &r) + : BaseDuration(r) + { + } + template<typename Rep, typename Period> constexpr Duration(const std::chrono::duration<Rep, Period> &d) : BaseDuration(d) diff --git a/src/libcamera/base/utils.cpp b/src/libcamera/base/utils.cpp index 8cf8a5b2..6a307940 100644 --- a/src/libcamera/base/utils.cpp +++ b/src/libcamera/base/utils.cpp @@ -407,6 +407,15 @@ std::string toAscii(const std::string &str) */ /** + * \fn Duration::Duration(const Rep &r) + * \brief Construct a Duration with \a r ticks + * \param[in] r The number of ticks + * + * The constructed \a Duration object is internally represented in double + * precision with \a r nanoseconds ticks. + */ + +/** * \fn Duration::Duration(const std::chrono::duration<Rep, Period> &d) * \brief Construct a Duration by converting an arbitrary std::chrono::duration * \param[in] d The std::chrono::duration object to convert from |