summaryrefslogtreecommitdiff
path: root/include/tools/datetime.hxx
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2015-10-08 13:24:19 +0200
committerJan Holesovsky <kendy@collabora.com>2015-10-08 15:35:39 +0200
commitbd0e0dc7bdf0b4e027a93ff0db330472e0b90897 (patch)
tree19e31d8f3bb4543cf9b8e7c18863d8bbed10f856 /include/tools/datetime.hxx
parentf1f0d12674ed362dc38ae2ed8c8a44ed97d7555e (diff)
Stream operator<<() for DateTime to help debugging.
Change-Id: I49810682dc02f4220fca786fcd17a5a0f9abda5a
Diffstat (limited to 'include/tools/datetime.hxx')
-rw-r--r--include/tools/datetime.hxx15
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: */