The Gaudi Framework  v32r2 (46d42edc)
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 <>
27  return "ns";
28  }
29 
30  template <>
32  return "us";
33  }
34 
35  template <>
37  return "ms";
38  }
39 
40  template <>
42  return "s";
43  }
44 
45  template <>
47  return "m";
48  }
49 
50  template <>
52  return "h";
53  }
54  } // namespace io
55 
57  template <class Rep, class Period>
59  os << d.count() << io::duration_unit( d );
60  return os;
61  }
62  } // namespace chrono
63 } // namespace std
64 
65 #endif // C++17
std::string duration_unit(T)
Return unit of std::chrono::duration.
Definition: ChronoIO.h:20
STL namespace.
STL class.
std::ostream & operator<<(std::ostream &os, const duration< Rep, Period > &d)
stream operator for std::chrono::duration including unit
Definition: ChronoIO.h:58
STL class.