tools/source/datetime/tdate.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
New commits: commit c4d169eb7f0b2abb96e6a210fbaae506eb354b4b Author: Eike Rathke <er...@redhat.com> AuthorDate: Tue Nov 22 18:53:44 2022 +0100 Commit: Eike Rathke <er...@redhat.com> CommitDate: Tue Nov 22 19:47:09 2022 +0100 Avoid second null-date check of convertDateToDaysNormalizing() This is micro-optimization, but.. Change-Id: Ic5d43bc0ce9343cf194e189777109636d3b587c4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143126 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Jenkins diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx index 6c33dca13558..4b135fc3008a 100644 --- a/tools/source/datetime/tdate.cxx +++ b/tools/source/datetime/tdate.cxx @@ -75,7 +75,13 @@ sal_Int32 Date::GetAsNormalizedDays() const assert(DateToDays( GetDay(), GetMonth(), GetYear() ) == 693594); return 693594; } - return DateToDays( GetDay(), GetMonth(), GetYear() ); + // Not calling comphelper::date::convertDateToDaysNormalizing() here just + // avoids a second check on null-date handling like above. + sal_uInt16 nDay = GetDay(); + sal_uInt16 nMonth = GetMonth(); + sal_Int16 nYear = GetYear(); + comphelper::date::normalize( nDay, nMonth, nYear); + return comphelper::date::convertDateToDays( nDay, nMonth, nYear); } sal_Int32 Date::DateToDays( sal_uInt16 nDay, sal_uInt16 nMonth, sal_Int16 nYear )