From 9830fd36dbdb72c79703b0c61efc027fba793c5a Mon Sep 17 00:00:00 2001 From: Lionel Elie Mamane Date: Sun, 17 Mar 2013 08:36:26 +0100 Subject: 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 --- reportdesign/source/filter/xml/xmlControlProperty.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'reportdesign') diff --git a/reportdesign/source/filter/xml/xmlControlProperty.cxx b/reportdesign/source/filter/xml/xmlControlProperty.cxx index aca8453b511d..7d4ec150a661 100644 --- a/reportdesign/source/filter/xml/xmlControlProperty.cxx +++ b/reportdesign/source/filter/xml/xmlControlProperty.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #define TYPE_DATE 1 #define TYPE_TIME 2 @@ -301,7 +302,7 @@ Any OXMLControlProperty::convertString(const ::com::sun::star::uno::Type& _rExpe ::com::sun::star::util::Date aDate = implGetDate(nValue); ::com::sun::star::util::DateTime aDateTime; - aDateTime.HundredthSeconds = aTime.HundredthSeconds; + aDateTime.NanoSeconds = aTime.NanoSeconds; aDateTime.Seconds = aTime.Seconds; aDateTime.Minutes = aTime.Minutes; aDateTime.Hours = aTime.Hours; @@ -329,10 +330,9 @@ Any OXMLControlProperty::convertString(const ::com::sun::star::uno::Type& _rExpe ::com::sun::star::util::Time OXMLControlProperty::implGetTime(double _nValue) { ::com::sun::star::util::Time aTime; - sal_uInt32 nIntValue = sal_Int32(_nValue * 8640000); - nIntValue *= 8640000; - aTime.HundredthSeconds = (sal_uInt16)( nIntValue % 100 ); - nIntValue /= 100; + sal_uInt64 nIntValue = ::rtl::math::round(_nValue * 86400000000000.0); + aTime.NanoSeconds = (sal_uInt16)( nIntValue % 1000000000 ); + nIntValue /= 1000000000; aTime.Seconds = (sal_uInt16)( nIntValue % 60 ); nIntValue /= 60; aTime.Minutes = (sal_uInt16)( nIntValue % 60 ); -- cgit