The Gaudi Framework
v32r0 (3325bb39)
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
ChronoIO.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <chrono>
4
#include <iostream>
5
6
#if __cplusplus <= 201703L
7
8
namespace
std
{
9
namespace
chrono {
10
17
namespace
io {
19
template
<
typename
T>
20
inline
std::string
duration_unit
( T ) {
21
return
""
;
22
}
23
24
// template specializations for units of time
25
template
<>
26
inline
std::string
duration_unit
(
std::chrono::nanoseconds
) {
27
return
"ns"
;
28
}
29
30
template
<>
31
inline
std::string
duration_unit
(
std::chrono::microseconds
) {
32
return
"us"
;
33
}
34
35
template
<>
36
inline
std::string
duration_unit
(
std::chrono::milliseconds
) {
37
return
"ms"
;
38
}
39
40
template
<>
41
inline
std::string
duration_unit
(
std::chrono::seconds
) {
42
return
"s"
;
43
}
44
45
template
<>
46
inline
std::string
duration_unit
(
std::chrono::minutes
) {
47
return
"m"
;
48
}
49
50
template
<>
51
inline
std::string
duration_unit
(
std::chrono::hours
) {
52
return
"h"
;
53
}
54
}
// namespace io
55
57
template
<
class
Rep,
class
Period>
58
std::ostream
& operator<<( std::ostream& os, const duration<Rep, Period>& d ) {
59
os << d.count() <<
io::duration_unit
( d );
60
return
os;
61
}
62
}
// namespace chrono
63
}
// namespace std
64
65
#endif // C++17
std::chrono::nanoseconds
std::chrono::io::duration_unit
std::string duration_unit(T)
Return unit of std::chrono::duration.
Definition:
ChronoIO.h:20
std
STL namespace.
std::string
STL class.
std::ostream
STL class.
GaudiKernel
Gaudi
Chrono
ChronoIO.h
Generated on Sat May 18 2019 11:01:38 for The Gaudi Framework by
1.8.11