From 31dfee9bf387aa05a7eb368972be92e321466757 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 23 May 2018 17:58:11 -0700 Subject: [PATCH] ircd: Add template ostream convenience for std::chrono::durations. --- include/ircd/date.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/ircd/date.h b/include/ircd/date.h index 852166211..28944fbd6 100644 --- a/include/ircd/date.h +++ b/include/ircd/date.h @@ -16,6 +16,7 @@ namespace ircd using microtime_t = std::pair; using steady_point = time_point; using system_point = time_point; + template using duration = std::chrono::duration; microtime_t microtime(); string_view microtime(const mutable_buffer &); @@ -45,6 +46,17 @@ namespace ircd template std::string timestr(args&&...); std::ostream &operator<<(std::ostream &, const system_point &); + template std::ostream &operator<<(std::ostream &, const duration &); +} + +template +std::ostream & +ircd::operator<<(std::ostream &s, + const duration &duration) +{ + s << duration.count(); + return s; } inline std::ostream &