format_timestamp: return <InvTC> for invalid timestamp_c objects

This commit is contained in:
Moritz Bunkus 2016-03-16 14:34:45 +01:00
parent 7c077c4b3d
commit c3ee7d3d90

View File

@ -31,6 +31,8 @@ template<typename T>
std::string
format_timestamp(basic_timestamp_c<T> const &timestamp,
unsigned int precision = 9) {
if (!timestamp.valid())
return "<InvTC>";
return format_timestamp(timestamp.to_ns(), precision);
}
@ -38,6 +40,8 @@ template<typename T>
std::string
format_timestamp(basic_timestamp_c<T> const &timestamp,
std::string const &format) {
if (!timestamp.valid())
return "<InvTC>";
return format_timestamp(timestamp.to_ns(), format);
}