[Libreoffice-commits] core.git: tools/source

Eike Rathke erack at redhat.com
Thu Jun 9 12:37:51 UTC 2016


 tools/source/datetime/tdate.cxx |   11 +++++++++++
 1 file changed, 11 insertions(+)

New commits:
commit 3724a9fa0d923c848d542562637880493cde9ca9
Author: Eike Rathke <erack at redhat.com>
Date:   Thu Jun 9 14:36:07 2016 +0200

    attempt to document the obscure MAX_DAYS value
    
    Change-Id: I8d8b36e6f61df4a683ce2d32ab0fde8ef003a2e0

diff --git a/tools/source/datetime/tdate.cxx b/tools/source/datetime/tdate.cxx
index 8b5cd2b..78b1ec6 100644
--- a/tools/source/datetime/tdate.cxx
+++ b/tools/source/datetime/tdate.cxx
@@ -29,6 +29,17 @@
 static const sal_uInt16 aDaysInMonth[12] = { 31, 28, 31, 30, 31, 30,
                                              31, 31, 30, 31, 30, 31 };
 
+// The number of days we internally handle.
+// Assuming the first valid positive date in a proleptic Gregorian calendar is
+// 0001-01-01, this results in an end date of 9957-06-26.
+// Hence we documented that years up to and including 9956 are handled.
+/* XXX: it is unclear history why this value was chosen, the representable
+ * 9999-12-31 would be 3652060 days from 0001-01-01. Even 9998-12-31 to
+ * distinguish from a maximum possible date would be 3651695. Better keep the
+ * value in case something somewhere relies on it or there is another reason
+ * beyond..
+ * At least connectivity/source/commontools/dbconversion.cxx has the same
+ * value to calculate with css::util::Date */
 #define MAX_DAYS    3636532
 
 namespace


More information about the Libreoffice-commits mailing list