From 05db422ca9b4340ecf451470b948c12ef4f3e927 Mon Sep 17 00:00:00 2001 From: Howard Hinnant Date: Thu, 13 Apr 2017 18:02:26 -0400 Subject: [PATCH] Respect width and padding in "chrono_io.h" --- chrono_io.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/chrono_io.h b/chrono_io.h index f08650f..15ab051 100644 --- a/chrono_io.h +++ b/chrono_io.h @@ -129,6 +129,16 @@ operator+(const string_literal& x, const string_literal& string_literal{y}}; } +template +inline +std::basic_string +operator+(std::basic_string x, + const string_literal& y) noexcept +{ + x.append(y.data(), y.size()); + return x; +} + template constexpr inline @@ -658,9 +668,8 @@ std::basic_ostream& operator<<(std::basic_ostream& os, const std::chrono::duration& d) { - using namespace std::chrono; - return os << d.count() - << detail::get_units(typename Period::type{}); + using namespace std; + return os << to_string(d.count()) + detail::get_units(typename Period::type{}); } } // namespace date