You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2017/06/21 14:07:07 UTC
svn commit: r1799451 - in /sis/branches/JDK8/core:
sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java
Author: desruisseaux
Date: Wed Jun 21 14:07:07 2017
New Revision: 1799451
URL: http://svn.apache.org/viewvc?rev=1799451&view=rev
Log:
Documentation clarification about Proleptic Gregorian calendar versus Proleptic Julian calendar.
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java?rev=1799451&r1=1799450&r2=1799451&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] Wed Jun 21 14:07:07 2017
@@ -1503,7 +1503,17 @@ public enum CommonCRS {
*/
public enum Temporal {
/**
- * Time measured as days since January 1st, 4713 BC at 12:00 UTC.
+ * Time measured as days since January 1st, 4713 BC at 12:00 UTC in proleptic Julian calendar.
+ * This epoch is equivalent to November 24, 4714 BC when expressed in the proleptic Gregorian
+ * calendar instead than the Julian one.
+ *
+ * <p><b>Note on dates formatting:</b>
+ * the legacy date/time formatting classes in the {@link java.text} package uses the proleptic
+ * Julian calendar for dates before October 15, 1582, while the new date/time formatting classes
+ * in the {@link java.time.format} package use the ISO-8601 calendar system, which is equivalent
+ * to the proleptic Gregorian calendar for every dates. For parsing and formatting of Julian days,
+ * the {@link java.text.SimpleDateFormat} class is closer to the common practice (but not ISO 8601
+ * compliant).</p>
*/
JULIAN(Vocabulary.Keys.Julian, -2440588L * MILLISECONDS_PER_DAY + MILLISECONDS_PER_DAY/2),
Modified: sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java?rev=1799451&r1=1799450&r2=1799451&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/test/java/org/apache/sis/internal/util/StandardDateFormatTest.java [UTF-8] Wed Jun 21 14:07:07 2017
@@ -83,20 +83,16 @@ public final strictfp class StandardDate
/**
* Tests formatting and parsing a negative year.
- * This test uses the Julian epoch (January 1st, 4713 BC at 12:00 UTC).
+ * This test uses the Julian epoch (January 1st, 4713 BC at 12:00 UTC in proleptic Julian calendar;
+ * equivalent to November 24, 4714 BC when expressed in the proleptic Gregorian calendar instead).
+ * We use astronomical year numbering: 4714 BC is numbered -4713.
*
* @throws ParseException if an error occurred while parsing the date.
*/
@Test
public void testNegativeYear() throws ParseException {
- final Date julian = new Date(-210866760000000L); // Same epoch than CommonCRS.Temporal.JULIAN.
- /*
- * java.util.Date and java.time.format disagree on the result of formatting that date,
- * maybe because they handle differently some aspects like the transition from Julian
- * calendar to Gregorian calendar (10 days). For Julian day calculation purpose, the
- * java.util.Date way is a more accurate match.
- */
- final String expected = "-4713-11-24T12:00:00.000";
+ final Date julian = new Date(-210866760000000L); // Same epoch than CommonCRS.Temporal.JULIAN.
+ final String expected = "-4713-11-24T12:00:00.000"; // Proleptic Gregorian calendar, astronomical year.
final StandardDateFormat f = new StandardDateFormat();
assertEquals(expected, f.format(julian));
assertEquals(julian, f.parse(expected));