MythTV master
mythtimer.h
Go to the documentation of this file.
1#ifndef MYTHTIMER_H_
2#define MYTHTIMER_H_
3
4#include <QElapsedTimer>
5#include "mythbaseexp.h"
6#include "mythchrono.h"
7
14{
15 public:
16 enum StartState : std::uint8_t {
19 };
20
21 explicit MythTimer(StartState state = kStartInactive);
22
23 void start(void);
24 std::chrono::milliseconds restart(void);
25 void stop(void);
26
27 void addMSecs(std::chrono::milliseconds ms);
28
29 std::chrono::milliseconds elapsed(void);
30 std::chrono::nanoseconds nsecsElapsed(void) const;
31 bool isRunning(void) const;
32
33 private:
34 QElapsedTimer m_timer;
35 std::chrono::milliseconds m_offset {0ms};
36};
37
38#endif
A QElapsedTimer based timer to replace use of QTime as a timer.
Definition: mythtimer.h:14
QElapsedTimer m_timer
Definition: mythtimer.h:34
@ kStartRunning
Definition: mythtimer.h:17
@ kStartInactive
Definition: mythtimer.h:18
#define MBASE_PUBLIC
Definition: mythbaseexp.h:15
static bool isRunning(const char *program)
Returns true if a program containing the specified string is running on this machine.