summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2022-11-22 18:53:44 +0100
committerEike Rathke <erack@redhat.com>2022-11-22 19:47:09 +0100
commitc4d169eb7f0b2abb96e6a210fbaae506eb354b4b (patch)
treec2debd129a589bd2121a07c25584eb606f8867a5 /tools
parent100c914d44ae8f362924fe567d7d41d0033ae8ad (diff)
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 <erack@redhat.com> Tested-by: Jenkins
Diffstat (limited to 'tools')
-rw-r--r--tools/source/datetime/tdate.cxx8
1 files changed, 7 insertions, 1 deletions
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 )