18 inline std::string
to_string(
const std::time_t & time )
20 std::ostringstream os;
26 template<
typename Clock,
typename Duration =
typename Clock::duration >
27 std::string
to_string(
const std::chrono::time_point< Clock, Duration > & tp )
29 auto in_time_t = std::chrono::system_clock::to_time_t( tp );
34 template<
typename Rep,
typename Period = std::ratio< 1 > >
35 std::string
to_string(
const std::chrono::duration< Rep, Period > & duration )
37 auto seconds_as_int = std::chrono::duration_cast< std::chrono::seconds >( duration );
38 if( seconds_as_int == duration )
40 auto seconds_as_double = std::chrono::duration_cast< std::chrono::duration< double > >( duration );
41 std::ostringstream os;
42 os << seconds_as_double.count();
48 template<
typename Clock,
typename Duration =
typename Clock::duration >
49 std::ostream & operator<<( std::ostream & o, const std::chrono::time_point< Clock, Duration > & tp )
55 template<
typename Rep,
typename Period = std::ratio< 1 > >
56 std::ostream & operator<<( std::ostream & o, const std::chrono::duration< Rep, Period > & duration )
std::string to_string(const std::time_t &time)
std::string to_string(T value)