From 32b4c33202d73acaeff2c0da536a66bcd811369e Mon Sep 17 00:00:00 2001 From: Evan Ward Date: Mon, 9 Aug 2021 15:27:07 -0400 Subject: [PATCH] Fix DateTimeComponents.toString() Delegate to toStringRfc3339(). Previously toString() had three issues: - could not print times during leap seconds - could round up to invalid times when within 0.5 ms of the next minute - generated invalid ISO 8601 because it left out the time zone The last point also lost information because the time zone information was never printed leading to two dates with the same local time having the same string representation. The implementation in toStringRfc3339() fixes these issues for all reasonable dates, but is not backwards compatible with the existing implementation. In particular it will include the time zone information and emit more digits to avoid rounding up. Fix #590 --- src/changes/changes.xml | 4 +++ .../org/orekit/time/DateTimeComponents.java | 2 +- .../org/orekit/time/AbsoluteDateTest.java | 8 ++--- .../orekit/time/DateTimeComponentsTest.java | 30 +++++++++++++++++-- 4 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 05c1c50a7..5f269d953 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -21,6 +21,10 @@ + + Fix DateTimeComponents.toString(): correct ISO 8601, leap second, rounding issues. + Backwards incompatible. + Allow data filtering upon loading to be used for explicit loading by applications. diff --git a/src/main/java/org/orekit/time/DateTimeComponents.java b/src/main/java/org/orekit/time/DateTimeComponents.java index 240a26d8d..4db7ba6ad 100644 --- a/src/main/java/org/orekit/time/DateTimeComponents.java +++ b/src/main/java/org/orekit/time/DateTimeComponents.java @@ -235,7 +235,7 @@ public class DateTimeComponents implements Serializable, Comparable