summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2013-06-27 08:50:37 +0200
committerFridrich Strba <fridrich@documentfoundation.org>2013-06-28 12:26:50 +0000
commitfe89aa916601e53637259c757a4da433fbc4feda (patch)
tree899fb758f6fa4bca70831f89d50c16de3ec27673 /connectivity
parent0b6233afdc65030fd7c4a57c5a2155f0d32b18df (diff)
fdo#66216 fix DBTypeConversion::toTimeString format
std::ostringstream::width is not sticky Change-Id: I32d77bec68506b7691a4f86dadb24e62fdc13d42 Reviewed-on: https://gerrit.libreoffice.org/4564 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/commontools/dbconversion.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx
index 0150cdd78f88..513a8b05d26e 100644
--- a/connectivity/source/commontools/dbconversion.cxx
+++ b/connectivity/source/commontools/dbconversion.cxx
@@ -28,6 +28,8 @@
#include <com/sun/star/util/Time.hpp>
#include <com/sun/star/util/DateTime.hpp>
#include <rtl/ustrbuf.hxx>
+#include <sstream>
+#include <iomanip>
#define MAX_DAYS 3636532
@@ -83,11 +85,12 @@ namespace dbtools
OUString DBTypeConversion::toTimeString(const Time& rTime)
{
std::ostringstream ostr;
+ using std::setw;
ostr.fill('0');
- ostr.width(2);
- ostr << rTime.Hours << ":" << rTime.Minutes << ":" << rTime.Seconds;
- ostr.width(9);
- ostr << "." << rTime.NanoSeconds;
+ ostr << setw(2) << rTime.Hours << ":"
+ << setw(2) << rTime.Minutes << ":"
+ << setw(2) << rTime.Seconds << "."
+ << setw(9) << rTime.NanoSeconds;
return OUString::createFromAscii(ostr.str().c_str());
}