From 8cc4e6c8f572d84dc004d97fa25d17fe85505dc6 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Tue, 22 Nov 2022 19:04:13 +0100 Subject: Calculate null-date days to assert only once Massively called it is really unnecessary to do that each and every time. The debug build is slow enough.. Change-Id: I06525e4ca1fa23a1d49dd735370eb157157800e7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143127 Reviewed-by: Eike Rathke Tested-by: Jenkins --- tools/source/datetime/tdate.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index 4b135fc3008a..e20add430353 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -72,7 +72,10 @@ sal_Int32 Date::GetAsNormalizedDays() const // This is a very common datum we often calculate from. if (mnDate == 18991230) // 1899-12-30 { - assert(DateToDays( GetDay(), GetMonth(), GetYear() ) == 693594); +#ifndef NDEBUG + static sal_Int32 nDays = DateToDays( GetDay(), GetMonth(), GetYear()); + assert(nDays == 693594); +#endif return 693594; } // Not calling comphelper::date::convertDateToDaysNormalizing() here just -- cgit