xmloff/source/core/xmluconv.cxx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
New commits: commit 7d79afebef281657a58cba065af0c5ba79a4e9e1 Author: Eike Rathke <[email protected]> AuthorDate: Wed Nov 29 19:11:22 2023 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Nov 30 13:07:05 2023 +0100 Resolves: tdf#158265 Store more than 100th seconds precision in date+time e.g. office:date-value Change-Id: I9bb4b589cdb8c6f04fa39ba7ec4254207eaa3663 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160124 Reviewed-by: Eike Rathke <[email protected]> Tested-by: Jenkins (cherry picked from commit 1627271703a39aad92cc5d5f5bfd75a8d7ab3d2b) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160040 Reviewed-by: Michael Stahl <[email protected]> diff --git a/xmloff/source/core/xmluconv.cxx b/xmloff/source/core/xmluconv.cxx index a95de5ecb66c..544bea50d3c5 100644 --- a/xmloff/source/core/xmluconv.cxx +++ b/xmloff/source/core/xmluconv.cxx @@ -61,7 +61,6 @@ using namespace ::com::sun::star::i18n; using namespace ::xmloff::token; -const sal_Int8 XML_MAXDIGITSCOUNT_TIME = 11; constexpr OUStringLiteral XML_NULLDATE = u"NullDate"; struct SvXMLUnitConverter::Impl @@ -444,6 +443,16 @@ void SvXMLUnitConverter::convertDateTime( OUStringBuffer& rBuffer, else fCount = 0.0; const int nDigits = sal_Int16(fCount) + 4; // +4 for *86400 in seconds + + // Since the beginning from initial source code import this was 11 without + // further explanation, effectively limiting fractions in ~current + // date+time to 2 decimals (maybe because old class Time code had a + // resolution of only 100th seconds). Preserve at least milliseconds, but + // strive for more. + // NOTE: sax/source/tools/converter.cxx uses 14-5 in a different context + // rounding nanoseconds and fractions of seconds. + constexpr int XML_MAXDIGITSCOUNT_TIME = 14; + const int nFractionDecimals = std::max( XML_MAXDIGITSCOUNT_TIME - nDigits, 0); sal_uInt16 nHour, nMinute, nSecond;
