Deskflow 1.24.0.365
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
11
16{
17public:
22 explicit Stopwatch(bool triggered = false);
23 ~Stopwatch() = default;
24
26
27
29
35 double reset();
36
38
43 void stop();
44
46
50 void start();
51
53
59 void setTrigger();
60
62
66 double getTime();
68
70
72
75 bool isStopped() const;
76
77 // return the time since the last reset().
79
83 double getTime() const;
85
86private:
87 double getClock() const;
88
89private:
90 double m_mark = 0.0;
91 bool m_triggered = false;
92 bool m_stopped = false;
93};
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:78
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