AbsoluteDate.JAVA_EPOCH returns Incorrect Time
Due to the linear model of offset between UTC and TAI (introduced in commit e8421aad) the java doc for AbsoluteDate.JAVA_EPOCH (commit 3098823c) is incorrect in its assertion that this returns a UTC date, and that UTC and TAI are synchronous prior to 1972. Calling this creates an AbsoluteDate that is shifted 8 seconds in UTC. A simple test is as follows:
public static void main(String[] args) {
AbsoluteDate epoch = AbsoluteDate.JAVA_EPOCH;
System.out.println(epoch.toString(TimeScalesFactory.getTAI()));
System.out.println(epoch.JAVA_EPOCH.toString());
//Milliseconds - April 1, 2006
long msOffset = 1143849600000l;
AbsoluteDate ad;
try {
ad = new AbsoluteDate(epoch, msOffset/1000,
TimeScalesFactory.getUTC());
System.out.println(ad);
} catch (OrekitException e) {
e.printStackTrace();
}
AbsoluteDate ad_2 = new AbsoluteDate(epoch, msOffset/1000,
TimeScalesFactory.getTAI());
System.out.println(ad_2);
}
Yields the following output:
1970-01-01T00:00:00.000
1969-12-31T23:59:52.000
2006-03-31T23:59:52.000
2006-03-31T23:59:27.000
The final result makes the most sense, given the offset is 33 seconds for April 1 2006. The other results display the 8 second shift from the linear model in the UTC frame.
A suitable workaround for the moment is to build a new epoch from the Date/Time Components.
AbsoluteDate java_epoch = new AbsoluteDate(DateComponents.JAVA_EPOCH,
TimeComponents.H00, TimeScalesFactory.getUTC());
AbsoluteDate ad = new AbsoluteDate(java_epoch, offset,
TimeScalesFactory.getUTC());
(from redmine: issue id 142, created on 2013-08-06, closed on 2013-08-06)