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 --- xmlsecurity/source/dialogs/resourcemanager.cxx | 4 +--- xmlsecurity/source/helper/xmlsignaturehelper.cxx | 12 +++--------- 2 files changed, 4 insertions(+), 12 deletions(-) (limited to 'xmlsecurity') diff --git a/xmlsecurity/source/dialogs/resourcemanager.cxx b/xmlsecurity/source/dialogs/resourcemanager.cxx index 5407d3933ae7..ed2c02c8d9da 100644 --- a/xmlsecurity/source/dialogs/resourcemanager.cxx +++ b/xmlsecurity/source/dialogs/resourcemanager.cxx @@ -52,9 +52,7 @@ namespace XmlSec DateTime GetDateTime( const ::com::sun::star::util::DateTime& _rDT ) { - return DateTime( - Date( _rDT.Day, _rDT.Month, _rDT.Year ), - tools::Time( _rDT.Hours, _rDT.Minutes, _rDT.Seconds, _rDT.NanoSeconds ) ); + return DateTime(_rDT); } OUString GetDateTimeString( const ::com::sun::star::util::DateTime& _rDT ) diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx index 4ffe2c27d243..9f04c58c0b64 100644 --- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx +++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx @@ -26,6 +26,7 @@ #include #include +#include #include @@ -121,16 +122,9 @@ void XMLSignatureHelper::SetX509Certificate( ouX509Cert); } -void XMLSignatureHelper::SetDateTime( sal_Int32 nSecurityId, const Date& rDate, const tools::Time& rTime ) +void XMLSignatureHelper::SetDateTime( sal_Int32 nSecurityId, const ::Date& rDate, const tools::Time& rTime ) { - ::com::sun::star::util::DateTime stDateTime; - stDateTime.NanoSeconds = rTime.GetNanoSec(); - stDateTime.Seconds = (::sal_uInt16)rTime.GetSec(); - stDateTime.Minutes = (::sal_uInt16)rTime.GetMin(); - stDateTime.Hours = (::sal_uInt16)rTime.GetHour(); - stDateTime.Day = (::sal_uInt16)rDate.GetDay(); - stDateTime.Month = (::sal_uInt16)rDate.GetMonth(); - stDateTime.Year = (::sal_uInt16)rDate.GetYear(); + css::util::DateTime stDateTime = ::DateTime(rDate, rTime).GetUNODateTime(); mpXSecController->setDate( nSecurityId, stDateTime ); } -- cgit