From c3ee7d3d90735cfb547783361108a0139360e222 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 16 Mar 2016 14:34:45 +0100 Subject: [PATCH] format_timestamp: return for invalid timestamp_c objects --- src/common/strings/formatting.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/common/strings/formatting.h b/src/common/strings/formatting.h index 43cb118f2..9eaf644f8 100644 --- a/src/common/strings/formatting.h +++ b/src/common/strings/formatting.h @@ -31,6 +31,8 @@ template std::string format_timestamp(basic_timestamp_c const ×tamp, unsigned int precision = 9) { + if (!timestamp.valid()) + return ""; return format_timestamp(timestamp.to_ns(), precision); } @@ -38,6 +40,8 @@ template std::string format_timestamp(basic_timestamp_c const ×tamp, std::string const &format) { + if (!timestamp.valid()) + return ""; return format_timestamp(timestamp.to_ns(), format); }