Kaydet (Commit) 1b0a4314 authored tarafından Lionel Elie Mamane's avatar Lionel Elie Mamane

new dbtools::DBTypeConversion::toTimeStringS for time in second precision

(no fractional second)

Change-Id: I8bf448783b24fceae9a750f40887d6296999b203
üst 83dc5c07
......@@ -81,6 +81,17 @@ namespace dbtools
return OUString::createFromAscii(s);
}
//------------------------------------------------------------------
OUString DBTypeConversion::toTimeStringS(const Time& rTime)
{
std::ostringstream ostr;
using std::setw;
ostr.fill('0');
ostr << setw(2) << rTime.Hours << ":"
<< setw(2) << rTime.Minutes << ":"
<< setw(2) << rTime.Seconds;
return OUString::createFromAscii(ostr.str().c_str());
}
//------------------------------------------------------------------
OUString DBTypeConversion::toTimeString(const Time& rTime)
{
std::ostringstream ostr;
......@@ -92,7 +103,6 @@ namespace dbtools
<< setw(9) << rTime.NanoSeconds;
return OUString::createFromAscii(ostr.str().c_str());
}
//------------------------------------------------------------------
OUString DBTypeConversion::toDateTimeString(const DateTime& _rDateTime)
{
......
......@@ -104,7 +104,7 @@ java_sql_Time::java_sql_Time( const ::com::sun::star::util::Time& _rOut ): java_
// Convert parameters
OUString sDateStr;
// java.sql.Time supports only whole seconds...
sDateStr = ::dbtools::DBTypeConversion::toTimeString(_rOut).copy(0, 8);
sDateStr = ::dbtools::DBTypeConversion::toTimeStringS(_rOut);
args[0].l = convertwchar_tToJavaString(t.pEnv,sDateStr);
// Turn off Java-Call for the constructor
......
......@@ -141,6 +141,8 @@ namespace dbtools
// return the date in the format %04d-%02d-%02d
static OUString toDateString(const ::com::sun::star::util::Date& rDate);
// return the time in the format %02d:%02d:%02d
static OUString toTimeStringS(const ::com::sun::star::util::Time& rTime);
// return the time in the format %02d:%02d:%02d.%09d
static OUString toTimeString(const ::com::sun::star::util::Time& rTime);
// return the DateTime in the format %04d-%02d-%02d %02d:%02d:%02d.%09d
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment