diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-04-06 18:12:54 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-04-07 10:20:28 +0300 |
commit | e2d00fbcbb1a9b2da50fa2e280817a0de1a7d286 (patch) | |
tree | 4316fa4c60da30057933a19c1ebc4e82879494a8 /include | |
parent | 1a9587b8f2de010026784c251179a64105f1fc91 (diff) |
libcamera: base: utils: Add missing constructor for Duration
The Duration class is missing the equivalent to the
std::chrono::duration constructor that takes a number of ticks expressed
as a scalar. Fix it, which allows initializing a Duration instance to 0
or 0.0.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/base/utils.h | 6 |
1 files changed, 6 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) |