-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtiming-custom.h
More file actions
42 lines (30 loc) · 838 Bytes
/
timing-custom.h
File metadata and controls
42 lines (30 loc) · 838 Bytes
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
#ifndef GUT_TIMINGCUSTOM_H
#define GUT_TIMINGCUSTOM_H
namespace gut {
class Duration {
double seconds_;
public:
explicit Duration(double seconds) : seconds_(seconds) {}
double seconds() const { return seconds_; }
bool operator>(double duration) const { return seconds_ > duration; }
};
std::string toString(const Duration& value) {
std::ostringstream oss;
oss << value.seconds() << "s";
return oss.str();
}
template<class T>
Duration match_duration(const Duration& source, const T& /*target*/) {
return source;
}
template<class T>
Duration match_duration(const T& source, const Duration& /*target*/) {
return Duration(source);
}
} // namespace gut
#ifdef _WIN32
#include "windows/timing-custom.h"
#elif __linux__
#include "linux/timing-custom.h"
#endif
#endif // GUT_TIMINGCUSTOM_H