1 // Copyright 2005-2019 The Mumble Developers. All rights reserved. 2 // Use of this source code is governed by a BSD-style license 3 // that can be found in the LICENSE file at the root of the 4 // Mumble source tree or at <https://www.mumble.info/LICENSE>. 5 6 #ifndef MUMBLE_TIMER_H_ 7 #define MUMBLE_TIMER_H_ 8 9 #include <QtCore/QtGlobal> 10 11 // All timer resolutions are in microseconds. 12 13 class Timer { 14 protected: 15 quint64 uiStart; 16 static quint64 now(); 17 public: 18 Timer(bool start = true); 19 bool isElapsed(quint64 us); 20 quint64 elapsed() const; 21 quint64 restart(); 22 bool isStarted() const; 23 24 /** 25 * Compares the elapsed time, not the start time 26 */ 27 bool operator<(const Timer &other) const; 28 29 /** 30 * Compares the elapsed time, not the start time 31 */ 32 bool operator>(const Timer &other) const; 33 }; 34 35 #endif 36