Commit ff2f5ccf authored by Luc Maisonobe's avatar Luc Maisonobe

Fixed handling of leap seconds in local time.

parent a0f700d1
......@@ -590,14 +590,14 @@ public abstract class ODMParser {
final DateTimeComponents clock = DateTimeComponents.parseDateTime(date);
final double offset = clock.getDate().getYear() * Constants.JULIAN_YEAR +
clock.getDate().getDayOfYear() * Constants.JULIAN_DAY +
clock.getTime().getSecondsInDay();
clock.getTime().getSecondsInUTCDay();
return missionReferenceDate.shiftedBy(offset);
}
case MRT: {
final DateTimeComponents clock = DateTimeComponents.parseDateTime(date);
final double offset = clock.getDate().getYear() * Constants.JULIAN_YEAR +
clock.getDate().getDayOfYear() * Constants.JULIAN_DAY +
clock.getTime().getSecondsInDay();
clock.getTime().getSecondsInUTCDay();
return missionReferenceDate.shiftedBy(offset);
}
default:
......
......@@ -313,7 +313,7 @@ public class TLE implements TimeStamped, Serializable {
buffer.append(addPadding("day", dtc.getDate().getDayOfYear(), '0', 3, true));
buffer.append('.');
// nota: 31250/27 == 100000000/86400
final int fraction = (int) FastMath.rint(31250 * dtc.getTime().getSecondsInDay() / 27.0);
final int fraction = (int) FastMath.rint(31250 * dtc.getTime().getSecondsInUTCDay() / 27.0);
buffer.append(addPadding("fraction", fraction, '0', 8, true));
buffer.append(' ');
......
......@@ -825,13 +825,10 @@ public class AbsoluteDate
final DateComponents dateComponents = new DateComponents(DateComponents.J2000_EPOCH, date);
TimeComponents timeComponents = new TimeComponents((int) time, offset2000B);
if (timeScale instanceof UTCScale) {
final UTCScale utc = (UTCScale) timeScale;
if (utc.insideLeap(this)) {
// fix the seconds number to take the leap into account
timeComponents = new TimeComponents(timeComponents.getHour(), timeComponents.getMinute(),
timeComponents.getSecond() + utc.getLeap(this));
}
if (timeScale.insideLeap(this)) {
// fix the seconds number to take the leap into account
timeComponents = new TimeComponents(timeComponents.getHour(), timeComponents.getMinute(),
timeComponents.getSecond() + timeScale.getLeap(this));
}
// build the components
......@@ -932,13 +929,7 @@ public class AbsoluteDate
* in ISO-8601 format with milliseconds accuracy
*/
public String toString(final TimeScale timeScale) {
final boolean inLeap;
if (timeScale instanceof UTCScale) {
inLeap = ((UTCScale) timeScale).insideLeap(this);
} else {
inLeap = false;
}
return getComponents(timeScale).toString(inLeap);
return getComponents(timeScale).toString(timeScale.insideLeap(this));
}
/** Get a String representation of the instant location for a local time.
......
......@@ -125,7 +125,7 @@ public class DateTimeComponents implements Serializable, Comparable<DateTimeComp
// extract linear data from reference date/time
int day = reference.getDate().getJ2000Day();
double seconds = reference.getTime().getSecondsInDay();
double seconds = reference.getTime().getSecondsInLocalDay();
// apply offset
seconds += offset;
......@@ -134,10 +134,12 @@ public class DateTimeComponents implements Serializable, Comparable<DateTimeComp
final int dayShift = (int) FastMath.floor(seconds / Constants.JULIAN_DAY);
seconds -= Constants.JULIAN_DAY * dayShift;
day += dayShift;
final TimeComponents tmpTime = new TimeComponents(seconds);
// set up components
this.date = new DateComponents(day);
this.time = new TimeComponents(seconds);
this.time = new TimeComponents(tmpTime.getHour(), tmpTime.getMinute(), tmpTime.getSecond(),
reference.getTime().getMinutesFromUTC());
}
......@@ -172,7 +174,7 @@ public class DateTimeComponents implements Serializable, Comparable<DateTimeComp
*/
public double offsetFrom(final DateTimeComponents dateTime) {
final int dateOffset = date.getJ2000Day() - dateTime.date.getJ2000Day();
final double timeOffset = time.getSecondsInDay() - dateTime.time.getSecondsInDay();
final double timeOffset = time.getSecondsInUTCDay() - dateTime.time.getSecondsInUTCDay();
return Constants.JULIAN_DAY * dateOffset + timeOffset;
}
......
......@@ -98,6 +98,16 @@ public class GMSTScale implements TimeScale {
return offset;
}
/** {@inheritDoc} */
public boolean insideLeap(final AbsoluteDate date) {
return false;
}
/** {@inheritDoc} */
public double getLeap(final AbsoluteDate date) {
return 0;
}
/** {@inheritDoc} */
public String getName() {
return "GMST";
......
......@@ -43,6 +43,16 @@ public class GPSScale implements TimeScale {
return 19;
}
/** {@inheritDoc} */
public boolean insideLeap(final AbsoluteDate date) {
return false;
}
/** {@inheritDoc} */
public double getLeap(final AbsoluteDate date) {
return 0;
}
/** {@inheritDoc} */
public String getName() {
return "GPS";
......
......@@ -50,6 +50,16 @@ public class GalileoScale implements TimeScale {
return 19;
}
/** {@inheritDoc} */
public boolean insideLeap(final AbsoluteDate date) {
return false;
}
/** {@inheritDoc} */
public double getLeap(final AbsoluteDate date) {
return 0;
}
/** {@inheritDoc} */
public String getName() {
return "GST";
......
......@@ -42,6 +42,16 @@ public class TAIScale implements TimeScale {
return 0;
}
/** {@inheritDoc} */
public boolean insideLeap(final AbsoluteDate date) {
return false;
}
/** {@inheritDoc} */
public double getLeap(final AbsoluteDate date) {
return 0;
}
/** {@inheritDoc} */
public String getName() {
return "TAI";
......
......@@ -69,6 +69,16 @@ public class TCBScale implements TimeScale {
return offset;
}
/** {@inheritDoc} */
public boolean insideLeap(final AbsoluteDate date) {
return false;
}
/** {@inheritDoc} */
public double getLeap(final AbsoluteDate date) {
return 0;
}
/** {@inheritDoc} */
public String getName() {
return "TCB";
......
......@@ -68,6 +68,16 @@ public class TCGScale implements TimeScale {
return offset;
}
/** {@inheritDoc} */
public boolean insideLeap(final AbsoluteDate date) {
return false;
}
/** {@inheritDoc} */
public double getLeap(final AbsoluteDate date) {
return 0;
}
/** {@inheritDoc} */
public String getName() {
return "TCG";
......
......@@ -58,6 +58,16 @@ public class TDBScale implements TimeScale {
return offset;
}
/** {@inheritDoc} */
public boolean insideLeap(final AbsoluteDate date) {
return false;
}
/** {@inheritDoc} */
public double getLeap(final AbsoluteDate date) {
return 0;
}
/** {@inheritDoc} */
public String getName() {
return "TDB";
......
......@@ -45,6 +45,16 @@ public class TTScale implements TimeScale {
return -32.184;
}
/** {@inheritDoc} */
public boolean insideLeap(final AbsoluteDate date) {
return false;
}
/** {@inheritDoc} */
public double getLeap(final AbsoluteDate date) {
return 0;
}
/** {@inheritDoc} */
public String getName() {
return "TT";
......
......@@ -251,11 +251,33 @@ public class TimeComponents implements Serializable, Comparable<TimeComponents>
/** Get the second number within the day.
* @return second number from 0.0 to Constants.JULIAN_DAY
* @deprecated as of 7.2, replaced with either {@link #getSecondsInLocalDay()}
* or {@link #getSecondsInUTCDay()}
*/
@Deprecated
public double getSecondsInDay() {
return getSecondsInLocalDay();
}
/** Get the second number within the local day, <em>without</em> applying the {@link #getMinutesFromUTC() offset from UTC}.
* @return second number from 0.0 to Constants.JULIAN_DAY
* @see #getSecondsInUTCDay()
* @since 7.2
*/
public double getSecondsInLocalDay() {
return second + 60 * minute + 3600 * hour;
}
/** Get the second number within the UTC day, applying the {@link #getMinutesFromUTC() offset from UTC}.
* @return second number from {@link #getMinutesFromUTC() -getMinutesFromUTC()}
* to Constants.JULIAN_DAY {@link #getMinutesFromUTC() + getMinutesFromUTC()}
* @see #getSecondsInLocalDay()
* @since 7.2
*/
public double getSecondsInUTCDay() {
return second + 60 * (minute - minutesFromUTC) + 3600 * hour;
}
/** Get a string representation of the time.
* @return string representation of the time
*/
......@@ -275,7 +297,7 @@ public class TimeComponents implements Serializable, Comparable<TimeComponents>
/** {@inheritDoc} */
public int compareTo(final TimeComponents other) {
return Double.compare(getSecondsInDay(), other.getSecondsInDay());
return Double.compare(getSecondsInUTCDay(), other.getSecondsInUTCDay());
}
/** {@inheritDoc} */
......
......@@ -45,6 +45,27 @@ public interface TimeScale extends Serializable {
*/
double offsetToTAI(final DateComponents date, final TimeComponents time);
/** Check if date is within a leap second introduction <em>in this time scale</em>.
* <p>
* This method will return false for all time scales that do <em>not</em>
* implement leap seconds, even if the date corresponds to a leap second
* in {@link UTCScale UTC scale}.
* </p>
* @param date date to check
* @return true if time is within a leap second introduction
*/
boolean insideLeap(final AbsoluteDate date);
/** Get the value of the previous leap.
* <p>
* This method will return 0.0 for all time scales that do <em>not</em>
* implement leap seconds.
* </p>
* @param date date to check
* @return value of the previous leap
*/
double getLeap(final AbsoluteDate date);
/** Get the name time scale.
* @return name of the time scale
*/
......
......@@ -61,6 +61,9 @@ public class TimeScalesFactory implements Serializable {
/** Galileo System Time scale. */
private static GalileoScale gst = null;
/** GLObal NAvigation Satellite System scale. */
private static GLONASSScale glonass = null;
/** Global Positioning System scale. */
private static GPSScale gps = null;
......@@ -332,6 +335,22 @@ public class TimeScalesFactory implements Serializable {
}
}
/** Get the GLObal NAvigation Satellite System time scale.
* @return GLObal NAvigation Satellite System time scale
* @exception OrekitException if UTC time scale cannot be retrieved
*/
public static GLONASSScale getGLONASS() throws OrekitException {
synchronized (TimeScalesFactory.class) {
if (glonass == null) {
glonass = new GLONASSScale(getUTC());
}
return glonass;
}
}
/** Get the Global Positioning System scale.
* @return Global Positioning System scale
*/
......
......@@ -71,6 +71,16 @@ public class UT1Scale implements TimeScale {
return offset;
}
/** {@inheritDoc} */
public boolean insideLeap(final AbsoluteDate date) {
return false;
}
/** {@inheritDoc} */
public double getLeap(final AbsoluteDate date) {
return 0;
}
/** {@inheritDoc} */
public String getName() {
return "UT1";
......
......@@ -159,10 +159,17 @@ public class UTCScale implements TimeScale {
} else {
// the date is nominally bracketed by two leaps
try {
// take offset from local time into account, but ignoring seconds,
// so when we parse an hour like 23:59:60.5 during leap seconds introduction,
// we do not jump to next day
final int minuteInDay = time.getHour() * 60 + time.getMinute() - time.getMinutesFromUTC();
final int correction = minuteInDay < 0 ? (minuteInDay - 1439) / 1440 : minuteInDay / 1440;
// find close neighbors, assuming date in TAI, i.e a date earlier than real UTC date
final int mjd = date.getMJD() + correction;
final List<UTCTAIOffset> neighbors =
cache.getNeighbors(new AbsoluteDate(date, time, TimeScalesFactory.getTAI()));
if (neighbors.get(1).getMJD() <= date.getMJD()) {
if (neighbors.get(1).getMJD() <= mjd) {
// the date is in fact just after a leap second!
return neighbors.get(1).getOffset(date, time);
} else {
......@@ -200,10 +207,7 @@ public class UTCScale implements TimeScale {
return cache.getLatest().getDate();
}
/** Check if date is within a leap second introduction.
* @param date date to check
* @return true if time is within a leap second introduction
*/
/** {@inheritDoc} */
public boolean insideLeap(final AbsoluteDate date) {
if (cache.getEarliest().getDate().compareTo(date) > 0) {
// the date is before the first known leap
......
......@@ -170,7 +170,7 @@ class UTCTAIOffset implements TimeStamped, Serializable {
*/
public double getOffset(final DateComponents date, final TimeComponents time) {
final int days = date.getMJD() - mjdRef;
final double fraction = time.getSecondsInDay();
final double fraction = time.getSecondsInUTCDay();
return offset + days * (slopeUTC * Constants.JULIAN_DAY) + fraction * slopeUTC;
}
......
......@@ -173,10 +173,10 @@ public class ITRFEquinoxProviderTest {
// time scales checks
AbsoluteDate date = new AbsoluteDate(new DateComponents(2007, 4, 5), TimeComponents.H12, utc);
Assert.assertEquals(0.50075444444444,
date.getComponents(tt).getTime().getSecondsInDay() / Constants.JULIAN_DAY,
date.getComponents(tt).getTime().getSecondsInUTCDay() / Constants.JULIAN_DAY,
5.0e-15);
Assert.assertEquals(0.499999165813831,
date.getComponents(ut1).getTime().getSecondsInDay() / Constants.JULIAN_DAY,
date.getComponents(ut1).getTime().getSecondsInUTCDay() / Constants.JULIAN_DAY,
1.0e-15);
// sidereal time check
......
......@@ -238,10 +238,10 @@ public class ITRFProviderTest {
// time scales checks
AbsoluteDate date = new AbsoluteDate(new DateComponents(2007, 4, 5), TimeComponents.H12, utc);
Assert.assertEquals(0.50075444444444,
date.getComponents(tt).getTime().getSecondsInDay() / Constants.JULIAN_DAY,
date.getComponents(tt).getTime().getSecondsInUTCDay() / Constants.JULIAN_DAY,
5.0e-15);
Assert.assertEquals(0.499999165813831,
date.getComponents(ut1).getTime().getSecondsInDay() / Constants.JULIAN_DAY,
date.getComponents(ut1).getTime().getSecondsInUTCDay() / Constants.JULIAN_DAY,
1.0e-15);
// sidereal time check
......
......@@ -55,6 +55,20 @@ public class GMSTScaleTest {
}
}
@Test
public void testDuringLeap() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final TimeScale scale = gmst;
final AbsoluteDate before = new AbsoluteDate(new DateComponents(1983, 06, 30),
new TimeComponents(23, 59, 59),
utc);
final AbsoluteDate during = before.shiftedBy(1.25);
Assert.assertTrue(utc.insideLeap(during));
Assert.assertEquals(1.0, utc.getLeap(during), 1.0e-10);
Assert.assertFalse(scale.insideLeap(during));
Assert.assertEquals(0.0, scale.getLeap(during), 1.0e-10);
}
@Before
public void setUp() throws OrekitException {
Utils.setDataRoot("regular-data");
......
......@@ -68,6 +68,20 @@ public class GPSScaleTest {
}
}
@Test
public void testDuringLeap() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final TimeScale scale = TimeScalesFactory.getGPS();
final AbsoluteDate before = new AbsoluteDate(new DateComponents(1983, 06, 30),
new TimeComponents(23, 59, 59),
utc);
final AbsoluteDate during = before.shiftedBy(1.25);
Assert.assertTrue(utc.insideLeap(during));
Assert.assertEquals(1.0, utc.getLeap(during), 1.0e-10);
Assert.assertFalse(scale.insideLeap(during));
Assert.assertEquals(0.0, scale.getLeap(during), 1.0e-10);
}
@Before
public void setUp() {
Utils.setDataRoot("regular-data");
......
......@@ -46,6 +46,20 @@ public class GalileoScaleTest {
Assert.assertEquals(tUTC, tGalileo);
}
@Test
public void testDuringLeap() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final TimeScale scale = TimeScalesFactory.getGST();
final AbsoluteDate before = new AbsoluteDate(new DateComponents(1983, 06, 30),
new TimeComponents(23, 59, 59),
utc);
final AbsoluteDate during = before.shiftedBy(1.25);
Assert.assertTrue(utc.insideLeap(during));
Assert.assertEquals(1.0, utc.getLeap(during), 1.0e-10);
Assert.assertFalse(scale.insideLeap(during));
Assert.assertEquals(0.0, scale.getLeap(during), 1.0e-10);
}
@Test
public void testConstant() {
TimeScale scale = TimeScalesFactory.getGST();
......
......@@ -70,6 +70,20 @@ public class TAIScaleTest {
Assert.assertEquals( 0.386009, components.getTime().getSecond(), 1.0e-10);
}
@Test
public void testDuringLeap() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final TimeScale scale = TimeScalesFactory.getTAI();
final AbsoluteDate before = new AbsoluteDate(new DateComponents(1983, 06, 30),
new TimeComponents(23, 59, 59),
utc);
final AbsoluteDate during = before.shiftedBy(1.25);
Assert.assertTrue(utc.insideLeap(during));
Assert.assertEquals(1.0, utc.getLeap(during), 1.0e-10);
Assert.assertFalse(scale.insideLeap(during));
Assert.assertEquals(0.0, scale.getLeap(during), 1.0e-10);
}
@Before
public void setUp() throws OrekitException {
Utils.setDataRoot("regular-data");
......
......@@ -62,6 +62,20 @@ public class TCBScaleTest {
}
}
@Test
public void testDuringLeap() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final TimeScale scale = TimeScalesFactory.getTCB();
final AbsoluteDate before = new AbsoluteDate(new DateComponents(1983, 06, 30),
new TimeComponents(23, 59, 59),
utc);
final AbsoluteDate during = before.shiftedBy(1.25);
Assert.assertTrue(utc.insideLeap(during));
Assert.assertEquals(1.0, utc.getLeap(during), 1.0e-10);
Assert.assertFalse(scale.insideLeap(during));
Assert.assertEquals(0.0, scale.getLeap(during), 1.0e-10);
}
@Test
public void testAAS06134() throws OrekitException {
......
......@@ -51,6 +51,20 @@ public class TCGScaleTest {
}
}
@Test
public void testDuringLeap() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final TimeScale scale = TimeScalesFactory.getTCG();
final AbsoluteDate before = new AbsoluteDate(new DateComponents(1983, 06, 30),
new TimeComponents(23, 59, 59),
utc);
final AbsoluteDate during = before.shiftedBy(1.25);
Assert.assertTrue(utc.insideLeap(during));
Assert.assertEquals(1.0, utc.getLeap(during), 1.0e-10);
Assert.assertFalse(scale.insideLeap(during));
Assert.assertEquals(0.0, scale.getLeap(during), 1.0e-10);
}
@Test
public void testReference() throws OrekitException {
DateComponents referenceDate = new DateComponents(1977, 01, 01);
......
......@@ -121,6 +121,20 @@ public class TDBScaleTest {
}
@Test
public void testDuringLeap() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final TimeScale scale = TimeScalesFactory.getTDB();
final AbsoluteDate before = new AbsoluteDate(new DateComponents(1983, 06, 30),
new TimeComponents(23, 59, 59),
utc);
final AbsoluteDate during = before.shiftedBy(1.25);
Assert.assertTrue(utc.insideLeap(during));
Assert.assertEquals(1.0, utc.getLeap(during), 1.0e-10);
Assert.assertFalse(scale.insideLeap(during));
Assert.assertEquals(0.0, scale.getLeap(during), 1.0e-10);
}
@Before
public void setUp() throws OrekitException {
Utils.setDataRoot("regular-data");
......
......@@ -82,6 +82,20 @@ public class TTScaleTest {
}
@Test
public void testDuringLeap() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final TimeScale scale = TimeScalesFactory.getTT();
final AbsoluteDate before = new AbsoluteDate(new DateComponents(1983, 06, 30),
new TimeComponents(23, 59, 59),
utc);
final AbsoluteDate during = before.shiftedBy(1.25);
Assert.assertTrue(utc.insideLeap(during));
Assert.assertEquals(1.0, utc.getLeap(during), 1.0e-10);
Assert.assertFalse(scale.insideLeap(during));
Assert.assertEquals(0.0, scale.getLeap(during), 1.0e-10);
}
@Before
public void setUp() throws OrekitException {
Utils.setDataRoot("regular-data");
......
......@@ -72,7 +72,7 @@ public class TimeComponentsTest {
Assert.assertEquals(10.0, time.getSecond(), 1.0e-10);
time = new TimeComponents(0.0);
Assert.assertEquals(0.0, time.getSecondsInDay(), 1.0e-10);
Assert.assertEquals(0.0, time.getSecondsInUTCDay(), 1.0e-10);
time = new TimeComponents(10, 10, 60.999);
Assert.assertEquals(10, time.getHour());
......@@ -80,20 +80,23 @@ public class TimeComponentsTest {
Assert.assertEquals(60.999, time.getSecond(), 1.0e-10);
time = new TimeComponents(43200.0);
Assert.assertEquals(43200.0, time.getSecondsInDay(), 1.0e-10);
Assert.assertEquals(43200.0, time.getSecondsInUTCDay(), 1.0e-10);
time = new TimeComponents(86399.999);
Assert.assertEquals(86399.999, time.getSecondsInDay(), 1.0e-10);
Assert.assertEquals(86399.999, time.getSecondsInUTCDay(), 1.0e-10);
time = new TimeComponents(2, 30, 0, 180);
Assert.assertEquals(+9000.0, time.getSecondsInLocalDay(), 1.0e-5);
Assert.assertEquals(-1800.0, time.getSecondsInUTCDay(), 1.0e-5);
}
@Test
public void testValues() {
Assert.assertEquals( 0.0, new TimeComponents( 0, 0, 0).getSecondsInDay(), 1.0e-10);
Assert.assertEquals(21600.0, new TimeComponents( 6, 0, 0).getSecondsInDay(), 1.0e-10);
Assert.assertEquals(43200.0, new TimeComponents(12, 0, 0).getSecondsInDay(), 1.0e-10);
Assert.assertEquals(64800.0, new TimeComponents(18, 0, 0).getSecondsInDay(), 1.0e-10);
Assert.assertEquals(86399.9, new TimeComponents(23, 59, 59.9).getSecondsInDay(), 1.0e-10);
Assert.assertEquals( 0.0, new TimeComponents( 0, 0, 0).getSecondsInLocalDay(), 1.0e-10);
Assert.assertEquals(21600.0, new TimeComponents( 6, 0, 0).getSecondsInLocalDay(), 1.0e-10);
Assert.assertEquals(43200.0, new TimeComponents(12, 0, 0).getSecondsInLocalDay(), 1.0e-10);
Assert.assertEquals(64800.0, new TimeComponents(18, 0, 0).getSecondsInLocalDay(), 1.0e-10);
Assert.assertEquals(86399.9, new TimeComponents(23, 59, 59.9).getSecondsInLocalDay(), 1.0e-10);
}
@Test
......@@ -112,15 +115,15 @@ public class TimeComponentsTest {
@Test
public void testParse() {
Assert.assertEquals(86399.9, TimeComponents.parseTime("235959.900").getSecondsInDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("23:59:59.900").getSecondsInDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("23:59:59,900").getSecondsInDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("235959.900Z").getSecondsInDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("23:59:59.900Z").getSecondsInDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("235959.900+10").getSecondsInDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("23:59:59.900+00").getSecondsInDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("235959.900-00:12").getSecondsInDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("23:59:59.900+00:00").getSecondsInDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("235959.900").getSecondsInLocalDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("23:59:59.900").getSecondsInLocalDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("23:59:59,900").getSecondsInLocalDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("235959.900Z").getSecondsInLocalDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("23:59:59.900Z").getSecondsInLocalDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("235959.900+10").getSecondsInLocalDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("23:59:59.900+00").getSecondsInLocalDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("235959.900-00:12").getSecondsInLocalDay(), 1.0e-10);
Assert.assertEquals(86399.9, TimeComponents.parseTime("23:59:59.900+00:00").getSecondsInLocalDay(), 1.0e-10);
}
@Test(expected=IllegalArgumentException.class)
......
......@@ -161,6 +161,20 @@ public class UT1ScaleTest {
}
@Test
public void testDuringLeap() throws OrekitException {
final TimeScale utc = TimeScalesFactory.getUTC();
final TimeScale scale = TimeScalesFactory.getUT1(IERSConventions.IERS_2010, true);
final AbsoluteDate before = new AbsoluteDate(new DateComponents(1983, 06, 30),
new TimeComponents(23, 59, 59),
utc);
final AbsoluteDate during = before.shiftedBy(1.25);
Assert.assertTrue(utc.insideLeap(during));
Assert.assertEquals(1.0, utc.getLeap(during), 1.0e-10);
Assert.assertFalse<