-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTimer.h
54 lines (42 loc) · 856 Bytes
/
Timer.h
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* Timer.h
*
* Created on: Dec 15, 2016
* Author: onrust
*/
#ifndef TIMER_H_
#define TIMER_H_
#include <chrono>
#include <string>
namespace SLM {
class Timer
{
public:
Timer();
virtual ~Timer();
std::chrono::duration<double> reset();
std::chrono::duration<double> getSplit();
std::chrono::duration<double> stop();
void start();
protected:
std::chrono::time_point<std::chrono::system_clock> startTime;
std::chrono::duration<double> interval;
};
class ProgressTimer: public Timer
{
public:
ProgressTimer();
virtual ~ProgressTimer();
std::string toString();
void nextPattern();
void nextLine();
void nextFile();
void disablePrinting();
private:
unsigned long long patterns = 0;
unsigned long long lines = 0;
unsigned int files = 0;
bool doPrint = true;
};
} /* namespace SLM */
#endif /* TIMER_H_ */