add a fast path for the 1999-12-31 date in calendar conversion

seen in:

https: //user-images.githubusercontent.com/833656/279971758-ef3d86b1-23ea-4e57-ad15-1f9b12df6bdd.svg
Change-Id: I76f5e83860ea49e52099ece670e7c259fd89e666
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158830
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
This commit is contained in:
Caolán McNamara 2023-11-02 12:56:23 +00:00
parent 86ab194c62
commit d392b24623

View File

@ -140,6 +140,15 @@ public:
HebrewDate(sal_Int32 m, sal_Int32 d, sal_Int32 y) : year(y), month(m), day(d) { }
explicit HebrewDate(sal_Int32 d) { // Computes the Hebrew date from the absolute date.
if (d == 730119) // 1999-12-31 : a very common date used in calc
{
year = 5760;
month = 10;
day = 22;
return;
}
year = (d + HebrewEpoch) / 366; // Approximation from below.
// Search forward for year from the approximation.
while (d >= HebrewDate(7,1,year + 1).GetAbsoluteDate())