From bd0e0dc7bdf0b4e027a93ff0db330472e0b90897 Mon Sep 17 00:00:00 2001 From: Jan Holesovsky Date: Thu, 8 Oct 2015 13:24:19 +0200 Subject: Stream operator<<() for DateTime to help debugging. Change-Id: I49810682dc02f4220fca786fcd17a5a0f9abda5a --- include/tools/datetime.hxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/tools/datetime.hxx') diff --git a/include/tools/datetime.hxx b/include/tools/datetime.hxx index 295c587d3b91..07e620343ed8 100644 --- a/include/tools/datetime.hxx +++ b/include/tools/datetime.hxx @@ -24,6 +24,8 @@ #include #include +#include + class TOOLS_DLLPUBLIC SAL_WARN_UNUSED DateTime : public Date, public tools::Time { public: @@ -113,6 +115,19 @@ inline DateTime& DateTime::operator =( const DateTime& rDateTime ) return *this; } +template< typename charT, typename traits > +inline std::basic_ostream & operator <<( + std::basic_ostream & stream, const DateTime& datetime) +{ + return stream << datetime.GetYear() << '-' << + std::setw(2) << std::setfill('0') << datetime.GetMonth() << '-' << + std::setw(2) << std::setfill('0') << datetime.GetDay() << ' ' << + std::setw(2) << std::setfill('0') << datetime.GetHour() << ':' << + std::setw(2) << std::setfill('0') << datetime.GetMin() << ':' << + std::setw(2) << std::setfill('0') << datetime.GetSec() << "." << + std::setw(9) << std::setfill('0') << datetime.GetNanoSec(); +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -- cgit