Deskflow 1.22.0.197
Keyboard and mouse sharing utility
Loading...
Searching...
No Matches
Stopwatch.h
Go to the documentation of this file.
1/*
2 * Deskflow -- mouse and keyboard sharing utility
3 * SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
4 * SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
5 * SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
6 */
7
8#pragma once
9
10#include "common/Common.h"
11
13
18{
19public:
24 explicit Stopwatch(bool triggered = false);
25 ~Stopwatch() = default;
26
28
29
31
37 double reset();
38
40
45 void stop();
46
48
52 void start();
53
55
61 void setTrigger();
62
64
68 double getTime();
70 operator double();
72
74
76
79 bool isStopped() const;
80
81 // return the time since the last reset().
83
87 double getTime() const;
89 operator double() const;
91
92private:
93 double getClock() const;
94
95private:
96 double m_mark = 0.0;
97 bool m_triggered = false;
98 bool m_stopped = false;
99};
double getTime()
Get elapsed time.
Definition Stopwatch.cpp:65
void start()
Start the timer.
Definition Stopwatch.cpp:47
Stopwatch(bool triggered=false)
Definition Stopwatch.cpp:15
bool isStopped() const
Check if timer is stopped.
Definition Stopwatch.cpp:83
void setTrigger()
Stop the timer and set the trigger.
Definition Stopwatch.cpp:59
void stop()
Stop the timer.
Definition Stopwatch.cpp:36
~Stopwatch()=default
double reset()
Reset the timer to zero.
Definition Stopwatch.cpp:22