svl/source/numbers/zforfind.cxx |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

New commits:
commit d6030b66f1cfb4b7cf9fc98996bb4674ea495377
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Thu Jul 18 17:51:17 2024 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Sun Jul 21 13:22:30 2024 +0200

    Pull today DateTime out of loop
    
    It's unnecessary to obtain system time twice or thrice and also prevents
    different today values when looping over midnight.
    
    Change-Id: Ifcf4917769bb1d853e326049711e295d54408eef
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170699
    Tested-by: Jenkins
    Reviewed-by: Eike Rathke <er...@redhat.com>

diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index f4b6e50451b8..9e3a7bc277a7 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -1805,9 +1805,10 @@ bool ImpSvNumberInputScan::GetDateRef( double& fDays, 
sal_uInt16& nCounter )
 
     const LocaleDataWrapper* pLoc = mrCurrentLanguageData.GetLocaleData();
     CalendarWrapper* pCal = mrCurrentLanguageData.GetCalendar();
+    const DateTime aToday{ DateTime( Date( Date::SYSTEM))};
     for ( int nTryOrder = 1; nTryOrder <= nFormatOrder; nTryOrder++ )
     {
-        pCal->setGregorianDateTime( DateTime( Date( Date::SYSTEM ) ) ); // 
today
+        pCal->setGregorianDateTime( aToday); // today
         OUString aOrgCalendar; // empty => not changed yet
         DateOrder DateFmt;
         bool bFormatTurn;
@@ -2063,7 +2064,7 @@ input for the following reasons:
                 {
                     if ( !bHadExact && nExactDateOrder )
                     {
-                        pCal->setGregorianDateTime( DateTime( Date( 
Date::SYSTEM ) ) ); // reset today
+                        pCal->setGregorianDateTime( aToday); // reset today
                     }
                     switch (DateFmt)
                     {

Reply via email to