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 /xmloff/source/forms/propertyimport.cxx | |
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 'xmloff/source/forms/propertyimport.cxx')
-rw-r--r-- | xmloff/source/forms/propertyimport.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/xmloff/source/forms/propertyimport.cxx b/xmloff/source/forms/propertyimport.cxx index a6c667c27166..53f249a13dd3 100644 --- a/xmloff/source/forms/propertyimport.cxx +++ b/xmloff/source/forms/propertyimport.cxx @@ -30,6 +30,7 @@ #include "callbacks.hxx" #include "xmloff/xmlnmspe.hxx" #include <tools/date.hxx> +#include <tools/time.hxx> #include <com/sun/star/util/Date.hpp> #include <com/sun/star/util/Time.hpp> #include <com/sun/star/util/DateTime.hpp> @@ -67,16 +68,15 @@ namespace ::com::sun::star::util::Time lcl_getTime(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; - aTime.Seconds = (sal_uInt16)( nIntValue % 60 ); - nIntValue /= 60; - aTime.Minutes = (sal_uInt16)( nIntValue % 60 ); - nIntValue /= 60; + sal_uInt64 nIntValue = static_cast<sal_uInt64>(_nValue * ::Time::nanoSecPerDay); + aTime.NanoSeconds = nIntValue % ::Time::nanoSecPerSec; + nIntValue /= ::Time::nanoSecPerSec; + aTime.Seconds = nIntValue % ::Time::secondPerMinute; + nIntValue /= ::Time::secondPerMinute; + aTime.Minutes = nIntValue % ::Time::minutePerHour; + nIntValue /= ::Time::minutePerHour; OSL_ENSURE(nIntValue < 24, "lcl_getTime: more than a day?"); - aTime.Hours = static_cast< sal_uInt16 >( nIntValue ); + aTime.Hours = nIntValue; return aTime; } @@ -219,7 +219,7 @@ Any PropertyConversion::convertString( SvXMLImport& _rImporter, const ::com::sun ::com::sun::star::util::Date aDate = lcl_getDate(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; |