From d392b24623a46058d0fa35e445a4ceae519c738f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 2 Nov 2023 12:56:23 +0000 Subject: [PATCH] add a fast path for the 1999-12-31 date in calendar conversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- i18npool/source/calendar/calendar_jewish.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/i18npool/source/calendar/calendar_jewish.cxx b/i18npool/source/calendar/calendar_jewish.cxx index ab5a32a221d8..19b55eaf8789 100644 --- a/i18npool/source/calendar/calendar_jewish.cxx +++ b/i18npool/source/calendar/calendar_jewish.cxx @@ -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())