mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd: Add template ostream convenience for std::chrono::durations.
This commit is contained in:
parent
5708d9c36b
commit
31dfee9bf3
1 changed files with 12 additions and 0 deletions
|
@ -16,6 +16,7 @@ namespace ircd
|
||||||
using microtime_t = std::pair<time_t, int32_t>;
|
using microtime_t = std::pair<time_t, int32_t>;
|
||||||
using steady_point = time_point<steady_clock>;
|
using steady_point = time_point<steady_clock>;
|
||||||
using system_point = time_point<system_clock>;
|
using system_point = time_point<system_clock>;
|
||||||
|
template<class rep, class period> using duration = std::chrono::duration<rep, period>;
|
||||||
|
|
||||||
microtime_t microtime();
|
microtime_t microtime();
|
||||||
string_view microtime(const mutable_buffer &);
|
string_view microtime(const mutable_buffer &);
|
||||||
|
@ -45,6 +46,17 @@ namespace ircd
|
||||||
template<class... args> std::string timestr(args&&...);
|
template<class... args> std::string timestr(args&&...);
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &, const system_point &);
|
std::ostream &operator<<(std::ostream &, const system_point &);
|
||||||
|
template<class rep, class period> std::ostream &operator<<(std::ostream &, const duration<rep, period> &);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class rep,
|
||||||
|
class period>
|
||||||
|
std::ostream &
|
||||||
|
ircd::operator<<(std::ostream &s,
|
||||||
|
const duration<rep, period> &duration)
|
||||||
|
{
|
||||||
|
s << duration.count();
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::ostream &
|
inline std::ostream &
|
||||||
|
|
Loading…
Reference in a new issue