diff options
author | Eike Rathke <erack@redhat.com> | 2023-11-29 19:11:22 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2023-11-29 23:56:53 +0100 |
commit | 0c3f57487c9cc29d172121b178938cdb2a8adc7b (patch) | |
tree | c2aca5212c7cd3988d2ad5935b311af7e3edbb52 /xmloff | |
parent | 79e8833305b9cedce4ebbcabc573866e22040b72 (diff) |
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 <erack@redhat.com>
Tested-by: Jenkins
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/core/xmluconv.cxx | 11 |
1 files changed, 10 insertions, 1 deletions
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; |