Lomiri
Loading...
Searching...
No Matches
ElapsedTimer.h
1
/*
2
* Copyright (C) 2015 Canonical Ltd.
3
*
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License, as
6
* published by the Free Software Foundation; either version 2.1 or 3.0
7
* of the License.
8
*
9
* This program is distributed in the hope that it will be useful, but
10
* WITHOUT ANY WARRANTY; without even the implied warranties of
11
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
12
* PURPOSE. See the applicable version of the GNU Lesser General Public
13
* License for more details.
14
*
15
* You should have received a copy of both the GNU Lesser General Public
16
* License along with this program. If not, see <http://www.gnu.org/licenses/>
17
*/
18
19
#ifndef LOMIRIUTIL_ELAPSEDTIMER_H
20
#define LOMIRIUTIL_ELAPSEDTIMER_H
21
22
#include <QElapsedTimer>
23
24
namespace
LomiriUtil {
25
29
class
AbstractElapsedTimer
{
30
public
:
31
virtual
~AbstractElapsedTimer
() {}
32
virtual
void
start() = 0;
33
virtual
qint64 msecsSinceReference()
const
= 0;
34
virtual
qint64 elapsed()
const
= 0;
35
};
36
40
class
ElapsedTimer
:
public
AbstractElapsedTimer
{
41
public
:
42
void
start()
override
{ m_timer.start(); }
43
qint64 msecsSinceReference()
const override
{
return
m_timer.msecsSinceReference(); }
44
qint64 elapsed()
const override
{
return
m_timer.isValid() ? m_timer.elapsed() : 0; }
45
private
:
46
QElapsedTimer m_timer;
47
};
48
49
}
// namespace LomiriUtil
50
51
#endif
// LOMIRIUTIL_ELAPSEDTIMER_H
LomiriUtil::AbstractElapsedTimer
Definition
ElapsedTimer.h:29
LomiriUtil::ElapsedTimer
Definition
ElapsedTimer.h:40
plugins
Utils
ElapsedTimer.h
Generated on Tue Feb 20 2024 15:16:11 for Lomiri by
1.9.8