diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-06-27 08:50:37 +0200 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2013-06-27 09:29:32 +0200 |
commit | b45b566e172938fd82f2be610c6c9dace87d4248 (patch) | |
tree | 9b2eb25ea37e4dfec1b151947dda67fb14e13e6c /connectivity | |
parent | 5a2c23ca59ba8e8b11e8397f80c5c6ff855c40b2 (diff) |
fdo#66216 fix DBTypeConversion::toTimeString format
std::ostringstream::width is not sticky
Change-Id: I32d77bec68506b7691a4f86dadb24e62fdc13d42
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/commontools/dbconversion.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx index cf455459be78..c90c0e76b619 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 @@ -82,11 +84,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()); } |