From 7e5f69aa33509a359b547b9a4a6569a55cd5d5c9 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 20 Oct 2024 22:51:02 +0500 Subject: Make tools::Time ctor taking sal_Int64 private This ctor is meant to set the value of nTime directly; and that value is not nanoseconds, but an encoded value, using SEC_/MIN_/HOUR_MASK. But in some places, this ctor was misused for setting of nanoseconds, which would only accidentally work for values less than one second. All places that initialized tools::Time with 0, now use EMPTY. This makes the ctor private; and for the very few cases where really the encoded value of nTime is stored / restored, fromEncodedTime is introduced. Change-Id: I1f1994bd9aab1b51a41b1de637619049fe820da4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175283 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- xmlsecurity/source/dialogs/certificateviewer.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'xmlsecurity/source/dialogs') diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx index 5ef8449bff08..2cd3e11e8571 100644 --- a/xmlsecurity/source/dialogs/certificateviewer.cxx +++ b/xmlsecurity/source/dialogs/certificateviewer.cxx @@ -193,12 +193,12 @@ CertificateViewerDetailsTP::CertificateViewerDetailsTP(weld::Container* pParent, DateTime aDateTime( DateTime::EMPTY ); utl::typeConvert( xCert->getNotValidBefore(), aDateTime ); - aLBEntry = Application::GetSettings().GetUILocaleDataWrapper().getDate(Date(aDateTime.GetDate())) + " "; - aLBEntry += Application::GetSettings().GetUILocaleDataWrapper().getTime(tools::Time(aDateTime.GetTime())); + aLBEntry = Application::GetSettings().GetUILocaleDataWrapper().getDate(aDateTime) + " "; + aLBEntry += Application::GetSettings().GetUILocaleDataWrapper().getTime(aDateTime); InsertElement( XsResId( STR_VALIDFROM ), aLBEntry, aLBEntry ); utl::typeConvert( xCert->getNotValidAfter(), aDateTime ); - aLBEntry = Application::GetSettings().GetUILocaleDataWrapper().getDate(Date(aDateTime.GetDate()) ) + " "; - aLBEntry += Application::GetSettings().GetUILocaleDataWrapper().getTime(tools::Time(aDateTime.GetTime())); + aLBEntry = Application::GetSettings().GetUILocaleDataWrapper().getDate(aDateTime) + " "; + aLBEntry += Application::GetSettings().GetUILocaleDataWrapper().getTime(aDateTime); InsertElement( XsResId( STR_VALIDTO ), aLBEntry, aLBEntry ); std::pair< OUString, OUString > pairSubject = -- cgit