diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-03-17 08:36:26 +0100 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2013-04-18 21:34:46 +0200 |
commit | 9830fd36dbdb72c79703b0c61efc027fba793c5a (patch) | |
tree | 2e9d698e6ca109dc6627adb5c84aa2b635bcfe92 /sax | |
parent | 5aaaf0694b6e3213685563fc3bc90d19b10f5c75 (diff) |
date/time IDL datatypes incompatible change
- nanosecond precision
- signed (allowed negative) year
Also: assorted improvements / bugfixes in date/time handling code.
Some factorisation of copy/pasted code.
Change-Id: I761a1b0b8731c82f19a0c37acbcf43d3c06d6cd6
Diffstat (limited to 'sax')
-rw-r--r-- | sax/qa/cppunit/test_converter.cxx | 47 | ||||
-rw-r--r-- | sax/source/tools/converter.cxx | 204 |
2 files changed, 128 insertions, 123 deletions
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx index 84d4da03db75..31e96bcf6cba 100644 --- a/sax/qa/cppunit/test_converter.cxx +++ b/sax/qa/cppunit/test_converter.cxx @@ -88,7 +88,7 @@ static bool eqDuration(util::Duration a, util::Duration b) { return a.Years == b.Years && a.Months == b.Months && a.Days == b.Days && a.Hours == b.Hours && a.Minutes == b.Minutes && a.Seconds == b.Seconds - && a.MilliSeconds == b.MilliSeconds + && a.NanoSeconds == b.NanoSeconds && a.Negative == b.Negative; } @@ -97,9 +97,10 @@ static void doTest(util::Duration const & rid, char const*const pis, { char const*const pos((i_pos) ? i_pos : pis); util::Duration od; - OUString is(OUString::createFromAscii(pis)); + OUString is(::rtl::OUString::createFromAscii(pis)); + SAL_INFO("sax.cppunit","about to convert '" << is << "'"); bool bSuccess = Converter::convertDuration(od, is); - SAL_INFO("sax.cppunit","" << od.Negative << " " << od.Years << "Y " << od.Months << "M " << od.Days << "D " << od.Hours << "H " << od.Minutes << "M " << od.Seconds << "S " << od.MilliSeconds << "m"); + SAL_INFO("sax.cppunit","" << (od.Negative ? "-" : "+") << " " << od.Years << "Y " << od.Months << "M " << od.Days << "D " << od.Hours << "H " << od.Minutes << "M " << od.Seconds << "S " << od.NanoSeconds << "n"); CPPUNIT_ASSERT(bSuccess); CPPUNIT_ASSERT(eqDuration(rid, od)); OUStringBuffer buf; @@ -113,7 +114,7 @@ static void doTestDurationF(char const*const pis) util::Duration od; bool bSuccess = Converter::convertDuration(od, OUString::createFromAscii(pis)); - SAL_INFO("sax.cppunit","" << od.Negative << " " << od.Years << "Y " << od.Months << "M " << od.Days << "D " << od.Hours << "H " << od.Minutes << "M " << od.Seconds << "S " << od.MilliSeconds << "H"); + SAL_INFO("sax.cppunit","" << (od.Negative ? "-" : "+") << " " << od.Years << "Y " << od.Months << "M " << od.Days << "D " << od.Hours << "H " << od.Minutes << "M " << od.Seconds << "S " << od.NanoSeconds << "n"); CPPUNIT_ASSERT(!bSuccess); } @@ -126,14 +127,15 @@ void ConverterTest::testDuration() doTest( util::Duration(false, 0, 0, 0, 52, 0, 0, 0), "PT52H" ); doTest( util::Duration(false, 0, 0, 0, 0, 717, 0, 0), "PT717M" ); doTest( util::Duration(false, 0, 0, 0, 0, 0, 121, 0), "PT121S" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 190), "PT0.19S" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 90), "PT0.09S" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9), "PT0.009S" ); - doTest( util::Duration(false, 0, 0, 0, 0, 0, 9, 999), - "PT9.999999999999999999999999999999S", "PT9.999S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 190000000), "PT0.19S", "PT0.190000000S"); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 90000000), "PT0.09S", "PT0.090000000S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9000000), "PT0.009S", "PT0.009000000S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 9), "PT0.000000009S", "PT0.000000009S" ); + doTest( util::Duration(false, 0, 0, 0, 0, 0, 9, 999999999), + "PT9.999999999999999999999999999999S", "PT9.999999999S" ); doTest( util::Duration(true , 0, 0, 9999, 0, 0, 0, 0), "-P9999D" ); - doTest( util::Duration(true , 7, 6, 5, 4, 3, 2, 10), - "-P7Y6M5DT4H3M2.01S" ); + doTest( util::Duration(true , 7, 6, 5, 4, 3, 2, 10000000), + "-P7Y6M5DT4H3M2.01S", "-P7Y6M5DT4H3M2.010000000S" ); doTest( util::Duration(false, 0, 6, 0, 0, 3, 0, 0), "P6MT3M" ); doTest( util::Duration(false, 0, 0, 0, 0, 0, 0, 0), "P0D" ); doTestDurationF("1Y1M"); // invalid: no ^P @@ -155,7 +157,7 @@ static bool eqDateTime(util::DateTime a, util::DateTime b) { return a.Year == b.Year && a.Month == b.Month && a.Day == b.Day && a.Hours == b.Hours && a.Minutes == b.Minutes && a.Seconds == b.Seconds - && a.HundredthSeconds == b.HundredthSeconds; + && a.NanoSeconds == b.NanoSeconds; } static void doTest(util::DateTime const & rdt, char const*const pis, @@ -164,8 +166,9 @@ static void doTest(util::DateTime const & rdt, char const*const pis, char const*const pos((i_pos) ? i_pos : pis); OUString is(OUString::createFromAscii(pis)); util::DateTime odt; + SAL_INFO("sax.cppunit","about to convert '" << is << "'"); bool bSuccess( Converter::convertDateTime(odt, is) ); - SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " H:" << odt.HundredthSeconds); + SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds); CPPUNIT_ASSERT(bSuccess); CPPUNIT_ASSERT(eqDateTime(rdt, odt)); OUStringBuffer buf; @@ -179,7 +182,7 @@ static void doTestDateTimeF(char const*const pis) util::DateTime odt; bool bSuccess = Converter::convertDateTime(odt, OUString::createFromAscii(pis)); - SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << "H M:" << odt.Minutes << " S:" << odt.Seconds << " H:" << odt.HundredthSeconds); + SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << "H M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds); CPPUNIT_ASSERT(!bSuccess); } @@ -201,16 +204,16 @@ void ConverterTest::testDateTime() doTest( util::DateTime(0, 0, 0, 0, 2, 1, 1)/*(0, 0, 12, 0, 1, 1, 1)*/, "0001-01-02T00:00:00+12:00", "0001-01-02T00:00:00" ); // "0001-01-01T12:00:00" ); - doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), - "9999-12-31T23:59:59.99" ); - doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), - "9999-12-31T23:59:59.99Z", "9999-12-31T23:59:59.99" ); - doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), + doTest( util::DateTime(990000000, 59, 59, 23, 31, 12, 9999), + "9999-12-31T23:59:59.99", "9999-12-31T23:59:59.990000000" ); + doTest( util::DateTime(990000000, 59, 59, 23, 31, 12, 9999), + "9999-12-31T23:59:59.99Z", "9999-12-31T23:59:59.990000000" ); + doTest( util::DateTime(999999999, 59, 59, 23, 31, 12, 9999), "9999-12-31T23:59:59.9999999999999999999999999999999999999", - "9999-12-31T23:59:59.99" ); - doTest( util::DateTime(99, 59, 59, 23, 31, 12, 9999), + "9999-12-31T23:59:59.999999999" ); + doTest( util::DateTime(999999999, 59, 59, 23, 31, 12, 9999), "9999-12-31T23:59:59.9999999999999999999999999999999999999Z", - "9999-12-31T23:59:59.99" ); + "9999-12-31T23:59:59.999999999" ); doTest( util::DateTime(0, 0, 0, 0, 29, 2, 2000), // leap year "2000-02-29T00:00:00-00:00", "2000-02-29T00:00:00" ); doTest( util::DateTime(0, 0, 0, 0, 29, 2, 1600), // leap year diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx index 22fa9060b154..6b88e10fbc51 100644 --- a/sax/source/tools/converter.cxx +++ b/sax/source/tools/converter.cxx @@ -29,6 +29,8 @@ #include <rtl/ustrbuf.hxx> #include <rtl/math.hxx> +#include <algorithm> + using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::util; @@ -43,8 +45,7 @@ static const sal_Char* gpsPT = "pt"; static const sal_Char* gpsINCH = "in"; static const sal_Char* gpsPC = "pc"; -const sal_Int8 XML_MAXDIGITSCOUNT_TIME = 11; -const sal_Int8 XML_MAXDIGITSCOUNT_DATETIME = 6; +const sal_Int8 XML_MAXDIGITSCOUNT_TIME = 14; /** convert string to measure using optional min and max values*/ bool Converter::convertMeasure( sal_Int32& rValue, @@ -658,15 +659,15 @@ void Converter::convertDuration(OUStringBuffer& rBuffer, fValue *= 60; double fSecsValue = ::rtl::math::approxFloor (fValue); fValue -= fSecsValue; - double f100SecsValue; - if (fValue > 0.00001) - f100SecsValue = ::rtl::math::round( fValue, XML_MAXDIGITSCOUNT_TIME - 5); + double fNanoSecsValue; + if (fValue > 0.00000000001) + fNanoSecsValue = ::rtl::math::round( fValue, XML_MAXDIGITSCOUNT_TIME - 5); else - f100SecsValue = 0.0; + fNanoSecsValue = 0.0; - if (f100SecsValue == 1.0) + if (fNanoSecsValue == 1.0) { - f100SecsValue = 0.0; + fNanoSecsValue = 0.0; fSecsValue += 1.0; } if (fSecsValue >= 60.0) @@ -691,15 +692,15 @@ void Converter::convertDuration(OUStringBuffer& rBuffer, if (fSecsValue < 10) rBuffer.append( sal_Unicode('0')); rBuffer.append( sal_Int32( fSecsValue)); - if (f100SecsValue > 0.0) + if (fNanoSecsValue > 0.0) { - OUString a100th( ::rtl::math::doubleToUString( fValue, + OUString aNS( ::rtl::math::doubleToUString( fValue, rtl_math_StringFormat_F, XML_MAXDIGITSCOUNT_TIME - 5, '.', true)); - if ( a100th.getLength() > 2 ) + if ( aNS.getLength() > 2 ) { rBuffer.append( sal_Unicode('.')); - rBuffer.append( a100th.copy( 2 ) ); // strip 0. + rBuffer.append( aNS.copy( 2 ) ); // strip "0." } } rBuffer.append( sal_Unicode('S')); @@ -816,12 +817,10 @@ bool Converter::convertDuration(double& rfTime, double fHour = nHours; double fMin = nMins; double fSec = nSecs; - double fSec100 = 0.0; double fFraction = sDoubleStr.toDouble(); fTempTime = fHour / 24; fTempTime += fMin / (24 * 60); fTempTime += fSec / (24 * 60 * 60); - fTempTime += fSec100 / (24 * 60 * 60 * 60); fTempTime += fFraction / (24 * 60 * 60); // negative duration? @@ -835,7 +834,7 @@ bool Converter::convertDuration(double& rfTime, return bSuccess; } -/** convert util::Duration to ISO "duration" string */ +/** convert util::Duration to ISO8601 "duration" string */ void Converter::convertDuration(OUStringBuffer& rBuffer, const ::util::Duration& rDuration) { @@ -844,9 +843,9 @@ void Converter::convertDuration(OUStringBuffer& rBuffer, rBuffer.append(sal_Unicode('-')); } rBuffer.append(sal_Unicode('P')); - const bool bHaveDate(static_cast<sal_Int32>(rDuration.Years) - +static_cast<sal_Int32>(rDuration.Months) - +static_cast<sal_Int32>(rDuration.Days)); + const bool bHaveDate(rDuration.Years != 0 || + rDuration.Months != 0 || + rDuration.Days != 0); if (rDuration.Years) { rBuffer.append(static_cast<sal_Int32>(rDuration.Years)); @@ -862,10 +861,10 @@ void Converter::convertDuration(OUStringBuffer& rBuffer, rBuffer.append(static_cast<sal_Int32>(rDuration.Days)); rBuffer.append(sal_Unicode('D')); } - const sal_Int32 nMSecs(static_cast<sal_Int32>(rDuration.Seconds) - + static_cast<sal_Int32>(rDuration.MilliSeconds)); - if (static_cast<sal_Int32>(rDuration.Hours) + - static_cast<sal_Int32>(rDuration.Minutes) + nMSecs) + if ( rDuration.Hours != 0 + || rDuration.Minutes != 0 + || rDuration.Seconds != 0 + || rDuration.NanoSeconds != 0 ) { rBuffer.append(sal_Unicode('T')); // time separator if (rDuration.Hours) @@ -878,37 +877,19 @@ void Converter::convertDuration(OUStringBuffer& rBuffer, rBuffer.append(static_cast<sal_Int32>(rDuration.Minutes)); rBuffer.append(sal_Unicode('M')); } - if (nMSecs) + if (rDuration.Seconds != 0 || rDuration.NanoSeconds != 0) { // seconds must not be omitted (i.e. ".42S" is not valid) rBuffer.append(static_cast<sal_Int32>(rDuration.Seconds)); - if (rDuration.MilliSeconds) + if (rDuration.NanoSeconds) { - rBuffer.append(sal_Unicode('.')); - const sal_Int32 nMilliSeconds(rDuration.MilliSeconds % 1000); - if (nMilliSeconds < 100) - { - rBuffer.append(sal_Unicode('0')); - } - if (nMilliSeconds < 10) - { - rBuffer.append(sal_Unicode('0')); - } - if (0 == (nMilliSeconds % 10)) - { - if (0 == (nMilliSeconds % 100)) - { - rBuffer.append(nMilliSeconds / 100); - } - else - { - rBuffer.append(nMilliSeconds / 10); - } - } - else - { - rBuffer.append(nMilliSeconds); - } + OSL_ENSURE(rDuration.NanoSeconds < 1000000000,"NanoSeconds cannot be more than 999 999 999"); + rBuffer.append('.'); + std::ostringstream ostr; + ostr.fill('0'); + ostr.width(9); + ostr << rDuration.NanoSeconds; + rBuffer.append(OUString::createFromAscii(ostr.str().c_str())); } rBuffer.append(sal_Unicode('S')); } @@ -928,7 +909,7 @@ readUnsignedNumber(const OUString & rString, sal_Int32 & io_rnPos, sal_Int32 & o_rNumber) { bool bOverflow(false); - sal_Int32 nTemp(0); + sal_Int64 nTemp(0); sal_Int32 nPos(io_rnPos); while (nPos < rString.getLength()) @@ -938,7 +919,7 @@ readUnsignedNumber(const OUString & rString, { nTemp *= 10; nTemp += (c - sal_Unicode('0')); - if (nTemp >= SAL_MAX_INT16) + if (nTemp >= SAL_MAX_INT32) { bOverflow = true; } @@ -961,6 +942,50 @@ readUnsignedNumber(const OUString & rString, return (bOverflow) ? R_OVERFLOW : R_SUCCESS; } +static Result +readUnsignedNumberMaxDigits(int maxDigits, + const ::rtl::OUString & rString, sal_Int32 & io_rnPos, + sal_Int32 & o_rNumber) +{ + bool bOverflow(false); + sal_Int64 nTemp(0); + sal_Int32 nPos(io_rnPos); + OSL_ENSURE(maxDigits >= 0, "negative amount of digits makes no sense"); + + while (nPos < rString.getLength()) + { + const sal_Unicode c = rString[nPos]; + if ((sal_Unicode('0') <= c) && (c <= sal_Unicode('9'))) + { + if (maxDigits > 0) + { + nTemp *= 10; + nTemp += (c - sal_Unicode('0')); + if (nTemp >= SAL_MAX_INT32) + { + bOverflow = true; + } + --maxDigits; + } + } + else + { + break; + } + ++nPos; + } + + if (io_rnPos == nPos) // read something? + { + o_rNumber = -1; + return R_NOTHING; + } + + io_rnPos = nPos; + o_rNumber = nTemp; + return (bOverflow) ? R_OVERFLOW : R_SUCCESS; +} + static bool readDurationT(const OUString & rString, sal_Int32 & io_rnPos) { @@ -1003,7 +1028,7 @@ readDurationComponent(const OUString & rString, return true; } -/** convert ISO "duration" string to util::Duration */ +/** convert ISO8601 "duration" string to util::Duration */ bool Converter::convertDuration(util::Duration& rDuration, const OUString& rString) { @@ -1035,7 +1060,7 @@ bool Converter::convertDuration(util::Duration& rDuration, sal_Int32 nHours(0); sal_Int32 nMinutes(0); sal_Int32 nSeconds(0); - sal_Int32 nMilliSeconds(0); + sal_Int32 nNanoSeconds(0); bTimePart = readDurationT(string, nPos); bSuccess = (R_SUCCESS == readUnsignedNumber(string, nPos, nTemp)); @@ -1080,7 +1105,8 @@ bool Converter::convertDuration(util::Duration& rDuration, // eeek! seconds are icky. if ((nPos < string.getLength()) && bSuccess) { - if (sal_Unicode('.') == string[nPos]) + if (string[nPos] == sal_Unicode('.') || + string[nPos] == sal_Unicode(',')) { ++nPos; if (-1 != nTemp) @@ -1088,27 +1114,15 @@ bool Converter::convertDuration(util::Duration& rDuration, nSeconds = nTemp; nTemp = -1; const sal_Int32 nStart(nPos); - bSuccess = - (R_NOTHING != readUnsignedNumber(string, nPos, nTemp)); + bSuccess = readUnsignedNumberMaxDigits(9, string, nPos, nTemp) == R_SUCCESS; if ((nPos < string.getLength()) && bSuccess) { if (-1 != nTemp) { - nTemp = -1; - const sal_Int32 nDigits = nPos - nStart; - OSL_ENSURE(nDigits > 0, "bad code monkey"); - const sal_Unicode cZero('0'); - nMilliSeconds = 100 * (string[nStart] - cZero); - if (nDigits >= 2) - { - nMilliSeconds += 10 * - (string[nStart+1] - cZero); - if (nDigits >= 3) - { - nMilliSeconds += (string[nStart+2] - cZero); - } - } - + const sal_Int32 nDigits = std::min<sal_Int32>(nPos - nStart, 9); + OSL_ENSURE(nDigits > 0, "bad code monkey: negative digits"); + nNanoSeconds=static_cast<double>(nTemp)*(1000000000.0/pow(10.0,nDigits)); + nTemp=-1; if (sal_Unicode('S') == string[nPos]) { ++nPos; @@ -1164,7 +1178,7 @@ bool Converter::convertDuration(util::Duration& rDuration, rDuration.Hours = static_cast<sal_Int16>(nHours); rDuration.Minutes = static_cast<sal_Int16>(nMinutes); rDuration.Seconds = static_cast<sal_Int16>(nSeconds); - rDuration.MilliSeconds = static_cast<sal_Int16>(nMilliSeconds); + rDuration.NanoSeconds = static_cast<sal_Int32>(nNanoSeconds); } return bSuccess; @@ -1232,13 +1246,14 @@ void Converter::convertDateTime( i_rBuffer.append(zero); } i_rBuffer.append( static_cast<sal_Int32>(i_rDateTime.Seconds) ); - if( i_rDateTime.HundredthSeconds > 0 ) { + if( i_rDateTime.NanoSeconds > 0 ) { + OSL_ENSURE(i_rDateTime.NanoSeconds < 1000000000,"NanoSeconds cannot be more than 999 999 999"); i_rBuffer.append(dot); - if( i_rDateTime.HundredthSeconds < 10 ) { - i_rBuffer.append(zero); - } - i_rBuffer.append( - static_cast<sal_Int32>(i_rDateTime.HundredthSeconds) ); + std::ostringstream ostr; + ostr.fill('0'); + ostr.width(9); + ostr << i_rDateTime.NanoSeconds; + i_rBuffer.append(OUString::createFromAscii(ostr.str().c_str())); } } } @@ -1259,7 +1274,7 @@ bool Converter::convertDateTime( util::DateTime& rDateTime, rDateTime.Hours = 0; rDateTime.Minutes = 0; rDateTime.Seconds = 0; - rDateTime.HundredthSeconds = 0; + rDateTime.NanoSeconds = 0; } return true; } @@ -1381,7 +1396,7 @@ bool Converter::convertDateOrDateTime( sal_Int32 nHours(0); sal_Int32 nMinutes(0); sal_Int32 nSeconds(0); - sal_Int32 nMilliSeconds(0); + sal_Int32 nNanoSeconds(0); if (bSuccess && bHaveTime) { { @@ -1419,37 +1434,26 @@ bool Converter::convertDateOrDateTime( bSuccess &= (0 <= nSeconds) && (nSeconds < 60); } if (bSuccess && (nPos < string.getLength()) && - (sal_Unicode('.') == string[nPos])) // fraction separator + (sal_Unicode('.') == string[nPos] || sal_Unicode(',') == string[nPos])) // fraction separator { ++nPos; const sal_Int32 nStart(nPos); sal_Int32 nTemp(0); - if (R_NOTHING == readUnsignedNumber(string, nPos, nTemp)) + if (R_NOTHING == readUnsignedNumberMaxDigits(9, string, nPos, nTemp)) { bSuccess = false; } if (bSuccess) { - // cannot use nTemp because of possible leading zeros - // and possible overflow => read digits directly - const sal_Int32 nDigits(nPos - nStart); + const sal_Int32 nDigits = std::min<sal_Int32>(nPos - nStart, 9); OSL_ENSURE(nDigits > 0, "bad code monkey"); - const sal_Unicode cZero('0'); - nMilliSeconds = 100 * (string[nStart] - cZero); - if (nDigits >= 2) - { - nMilliSeconds += 10 * (string[nStart+1] - cZero); - if (nDigits >= 3) - { - nMilliSeconds += (string[nStart+2] - cZero); - } - } + nNanoSeconds=static_cast<double>(nTemp)*(1000000000.0/pow(10.0,nDigits)); } } if (bSuccess && (nHours == 24)) { - if (!((0 == nMinutes) && (0 == nSeconds) && (0 == nMilliSeconds))) + if (!((0 == nMinutes) && (0 == nSeconds) && (0 == nNanoSeconds))) { bSuccess = false; // only 24:00:00 is valid } @@ -1533,9 +1537,7 @@ bool Converter::convertDateOrDateTime( rDateTime.Hours = static_cast<sal_uInt16>(nHours); rDateTime.Minutes = static_cast<sal_uInt16>(nMinutes); rDateTime.Seconds = static_cast<sal_uInt16>(nSeconds); - // util::DateTime does not support 3 decimal digits of precision! - rDateTime.HundredthSeconds = - static_cast<sal_uInt16>(nMilliSeconds / 10); + rDateTime.NanoSeconds = static_cast<sal_uInt32>(nNanoSeconds); rbDateTime = true; } else @@ -2279,7 +2281,7 @@ bool Converter::convertAny(OUStringBuffer& rsValue, aTempValue.Day = aDate.Day; aTempValue.Month = aDate.Month; aTempValue.Year = aDate.Year; - aTempValue.HundredthSeconds = 0; + aTempValue.NanoSeconds = 0; aTempValue.Seconds = 0; aTempValue.Minutes = 0; aTempValue.Hours = 0; @@ -2294,7 +2296,7 @@ bool Converter::convertAny(OUStringBuffer& rsValue, aTempValue.Days = 0; aTempValue.Months = 0; aTempValue.Years = 0; - aTempValue.MilliSeconds = aTime.HundredthSeconds * 10; + aTempValue.NanoSeconds = aTime.NanoSeconds; aTempValue.Seconds = aTime.Seconds; aTempValue.Minutes = aTime.Minutes; aTempValue.Hours = aTime.Hours; |