summaryrefslogtreecommitdiff
path: root/include/libcamera/timer.h
blob: 97dcc01f493dc70d13248739c82410a935ec0593 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 * Copyright (C) 2019, Google Inc.
 *
 * timer.h - Generic timer
 */
#ifndef __LIBCAMERA_TIMER_H__
#define __LIBCAMERA_TIMER_H__

#include <cstdint>

#include <libcamera/signal.h>

namespace libcamera {

class Timer
{
public:
	Timer();

	void start(unsigned int msec);
	void stop();
	bool isRunning() const;

	unsigned int interval() const { return interval_; }
	uint64_t deadline() const { return deadline_; }

	Signal<Timer *> timeout;

private:
	unsigned int interval_;
	uint64_t deadline_;
};

} /* namespace libcamera */

#endif /* __LIBCAMERA_TIMER_H__ */