Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Timer.h « src - github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e757bc8d9869ad5790f63a92214b523037f77ca3 (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
// Copyright 2005-2016 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#ifndef MUMBLE_TIMER_H_
#define MUMBLE_TIMER_H_

#include <QtCore/QtGlobal>

// All timer resolutions are in microseconds.

class Timer {
	protected:
		quint64 uiStart;
		static quint64 now();
	public:
		Timer(bool start = true);
		bool isElapsed(quint64 us);
		quint64 elapsed() const;
		quint64 restart();
		bool isStarted() const;

		/**
		 * Compares the elapsed time, not the start time
		 */
		bool operator<(const Timer &other) const;

		/**
		 * Compares the elapsed time, not the start time
		 */
		bool operator>(const Timer &other) const;
};

#endif