From c32a5a3b8e2e3a49ac9f1fd3f2872b00612676b7 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 11 Jan 2015 13:35:38 +0200 Subject: simplify Date/Time/DateTime conversion code add constructors to Date/DateTime/Time, that take the css::util counterparts, to simplify code converting between these type Change-Id: I4b03da02c63f65b6ec18cb4d6ecc3859bdef1ff7 Reviewed-on: https://gerrit.libreoffice.org/13855 Tested-by: Jenkins Reviewed-by: Eike Rathke --- forms/source/xforms/datatypes.cxx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'forms') diff --git a/forms/source/xforms/datatypes.cxx b/forms/source/xforms/datatypes.cxx index 69d58fad40b7..2bc451044768 100644 --- a/forms/source/xforms/datatypes.cxx +++ b/forms/source/xforms/datatypes.cxx @@ -808,7 +808,7 @@ namespace xforms if ( !( aTypedValue >>= aValue ) ) return false; - ::tools::Time aToolsTime( aValue.Hours, aValue.Minutes, aValue.Seconds, aValue.NanoSeconds ); + ::tools::Time aToolsTime( aValue ); // no loss/rounding; IEEE 754 double-precision floating-point // has a mantissa of 53 bits; we need at the very most 50 bits: // format of aToolsTime.GetTime() is (in decimal) hhmmssnnnnnnnnn @@ -832,7 +832,7 @@ namespace xforms { css::util::Time aValue; OSL_VERIFY( _rValue >>= aValue ); - ::tools::Time aToolsTime( aValue.Hours, aValue.Minutes, aValue.Seconds, aValue.NanoSeconds ); + ::tools::Time aToolsTime( aValue ); _rDoubleValue = aToolsTime.GetTime(); } @@ -853,10 +853,7 @@ namespace xforms { double lcl_normalizeDateTime( const DateTime& _rValue ) { - ::DateTime aToolsValue( - ::Date( _rValue.Day, _rValue.Month, _rValue.Year ), - ::tools::Time( _rValue.Hours, _rValue.Minutes, _rValue.Seconds, _rValue.NanoSeconds ) - ); + ::DateTime aToolsValue(_rValue); double fValue = 0; // days since 1.1.1900 (which is relatively arbitrary but fixed date) -- cgit