openPilotLog
atimer.h
1 /*
2  *openPilotLog - A FOSS Pilot Logbook Application
3  *Copyright (C) 2020-2022 Felix Turowsky
4  *
5  *This program is free software: you can redistribute it and/or modify
6  *it under the terms of the GNU General Public License as published by
7  *the Free Software Foundation, either version 3 of the License, or
8  *(at your option) any later version.
9  *
10  *This program is distributed in the hope that it will be useful,
11  *but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  *GNU General Public License for more details.
14  *
15  *You should have received a copy of the GNU General Public License
16  *along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 #ifndef ATIMER_H
19 #define ATIMER_H
20 
21 #include <QObject>
22 #include <chrono>
23 #include <QDebug>
24 #include "src/functions/log.h"
25 
35 class ATimer : public QObject
36 {
37  Q_OBJECT
38 public:
39  ATimer(QObject* parent = nullptr);
40  ~ATimer();
41 
45  long timeNow();
46 private:
47 
48  std::chrono::high_resolution_clock::time_point start;
49 
50  std::chrono::high_resolution_clock::time_point intermediate_point;
51 
52  std::chrono::high_resolution_clock::time_point stop;
53 
54  double duration;
55 
56 };
57 
58 
59 #endif // ATIMER_H
The ATimer class provides an easy to use performance timer.
Definition: atimer.h:36
long timeNow()
timeNow takes an intermediate timing and returns miliseconds elapsed.
Definition: atimer.cpp:47