diff options
Diffstat (limited to 'include/tools')
-rw-r--r-- | include/tools/datetime.hxx | 15 |
1 files changed, 15 insertions, 0 deletions
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 <tools/time.hxx> #include <com/sun/star/util/DateTime.hpp> +#include <iomanip> + 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<charT, traits> & operator <<( + std::basic_ostream<charT, traits> & 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: */ |