summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-09-14 03:40:47 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-09-14 15:05:45 +0300
commitcecfeed61e8bcb4b53c2ed8e1b26d8c8af38b8e3 (patch)
tree783fca9b32651efdca054ad152528b40f2566a74 /include
parent98dff063f2f497434978a46f9a676307365fd878 (diff)
libcamera: Switch to the std::chrono API
Replace the clock_gettime()-based API with durations expressed as integers with the std::chrono API. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'include')
-rw-r--r--include/libcamera/timer.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/include/libcamera/timer.h b/include/libcamera/timer.h
index f47b6a58..476ae45f 100644
--- a/include/libcamera/timer.h
+++ b/include/libcamera/timer.h
@@ -7,6 +7,7 @@
#ifndef __LIBCAMERA_TIMER_H__
#define __LIBCAMERA_TIMER_H__
+#include <chrono>
#include <cstdint>
#include <libcamera/object.h>
@@ -22,12 +23,13 @@ public:
Timer(Object *parent = nullptr);
~Timer();
- void start(unsigned int msec);
+ void start(unsigned int msec) { start(std::chrono::milliseconds(msec)); }
+ void start(std::chrono::milliseconds interval);
void stop();
bool isRunning() const;
- unsigned int interval() const { return interval_; }
- uint64_t deadline() const { return deadline_; }
+ std::chrono::milliseconds interval() const { return interval_; }
+ std::chrono::steady_clock::time_point deadline() const { return deadline_; }
Signal<Timer *> timeout;
@@ -38,8 +40,8 @@ private:
void registerTimer();
void unregisterTimer();
- unsigned int interval_;
- uint64_t deadline_;
+ std::chrono::milliseconds interval_;
+ std::chrono::steady_clock::time_point deadline_;
};
} /* namespace libcamera */