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 /reportdesign | |
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 'reportdesign')
-rw-r--r-- | reportdesign/source/filter/xml/xmlControlProperty.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
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 <tools/datetime.hxx> #include <unotools/datetime.hxx> #include <com/sun/star/util/DateTime.hpp> +#include <rtl/math.hxx> #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 ); |