|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wisc.ssec.mcidasv.data.adde.sgp4.Time
public class Time
Used to keep track of a time and convert to multiple formats.
Field Summary | |
---|---|
private GregorianCalendar |
currentTime
|
static int |
DATE
date type |
private DateFormat |
dateFormat
|
private static DecimalFormat |
fmt2Dig
|
private static DecimalFormat |
fmt4Dig
|
static int |
HOUR
hour type |
static int |
HOUR_OF_DAY
Hour type |
static int |
MILLISECOND
Millisecond type |
static int |
MINUTE
Minute type |
private double |
mjd
|
private double |
mjde
|
static int |
MONTH
month type |
static int |
SECOND
Second type |
private static TimeZone |
tz
|
private TimeZone |
tzStringFormat
|
static int |
YEAR
year type |
Constructor Summary | |
---|---|
Time()
Default Constructor |
|
Time(int year,
int month,
int day,
int hour,
int min,
double sec)
Constructor with given calendar date (UT) |
Method Summary | |
---|---|
void |
add(int unit,
int val)
Add specified value in specified time unit to current time |
void |
addSeconds(double seconds)
Add specified seconds to current time |
static double |
calcMjd(Calendar cal)
Calculate Modified Julian Date from calendar object |
static double |
calcMjd(int year,
int month,
int day,
int hour,
int min,
double sec)
Calculate Modified Julian Date from calendar date and time elements |
static GregorianCalendar |
convertJD2Calendar(double jd)
|
String |
convertJD2String(double jd)
|
static double |
deltaT(double givenMJD)
Return TT minus UT. |
int |
get(int field)
Returns the specified field |
GregorianCalendar |
getCurrentGregorianCalendar()
|
DateFormat |
getDateFormat()
Gets the date format |
String |
getDateTimeStr()
|
double |
getJulianDate()
Gets the Julian Date (UT) |
double |
getMJD()
Gets the Modified Julian Date (Julian date minus 2400000.5) (UT) |
double |
getMJDE()
Gets the Modified Julian Ephemeris Date (Julian date minus 2400000.5) (TT) |
static void |
main(String[] args)
|
void |
set(long milliseconds)
Set the current time (UT) to the number of milliseconds |
void |
setDateFormat(SimpleDateFormat dateFormat)
Set SimpleDateFormat for displaying date/time string |
void |
setDateFormat(String formatStr)
Set SimpleDateFormat string ISSUE - only valid after Jan 1, 1970 |
void |
setTzStringFormat(TimeZone aTzStringFormat)
Sets timezone for the output string to use via the function getDateTimeStr() |
void |
update2CurrentTime()
Updates the time to current system time |
private void |
updateTimeMeasures()
Updates the Julian and Julian Epehermis Dates using Current GregorianCalendar |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int YEAR
public static final int MONTH
public static final int DATE
public static final int HOUR
public static final int HOUR_OF_DAY
public static final int MINUTE
public static final int SECOND
public static final int MILLISECOND
private GregorianCalendar currentTime
private double mjd
private double mjde
private static final DecimalFormat fmt4Dig
private static final DecimalFormat fmt2Dig
private DateFormat dateFormat
private static final TimeZone tz
private TimeZone tzStringFormat
Constructor Detail |
---|
public Time()
public Time(int year, int month, int day, int hour, int min, double sec)
year
- yearmonth
- month (1-12)day
- day of monthhour
- hour 0-24min
- minutesec
- second and fraction of second (accurate up to 1 millisecond)Method Detail |
---|
public static void main(String[] args)
public void update2CurrentTime()
public void set(long milliseconds)
milliseconds
- number of millisconds as in from the function Calendar.getTimeInMillis()public void add(int unit, int val)
unit
- int Time unitval
- int Time incrementpublic void addSeconds(double seconds)
seconds
- number of seconds to add to current time (can be fractional)private void updateTimeMeasures()
public double getJulianDate()
public double getMJD()
public double getMJDE()
public void setTzStringFormat(TimeZone aTzStringFormat)
aTzStringFormat
- time zone to format output strings withpublic void setDateFormat(SimpleDateFormat dateFormat)
dateFormat
- SimpleDateFormatpublic void setDateFormat(String formatStr)
formatStr
- String format for simple date format to use for creating strings of the datepublic DateFormat getDateFormat()
public final int get(int field)
field
- int The specified field
public String getDateTimeStr()
public static double calcMjd(Calendar cal)
cal
- Calendar object
public static double calcMjd(int year, int month, int day, int hour, int min, double sec)
year
- calendar yearmonth
- calendar monthday
- calendar dayhour
- calendar hour (0-24)min
- calendar minsec
- calendar sec
public static double deltaT(double givenMJD)
Up to 1983 Ephemeris Time (ET) was used in place of TT, between 1984 and 2000 Temps Dynamique Terrestrial (TDT) was used in place of TT. The three time scales, while defined differently, form a continuous time scale for most purposes. TT has a fixed offset from TAI (Temps Atomique International).
This method returns the difference TT - UT in days. Usually this would be looked up in a table published after the fact. Here we use polynomial fits for the distant past, for the future and also for the time where the table exists. Except for 1987 to 2015, the expressions are taken from Jean Meeus, 1991, Astronomical Algorithms, Willmann-Bell, Richmond VA, p.73f. For the present (1987 to 2015 we use our own graphical linear fit to the data 1987 to 2001 from USNO/RAL, 2001, Astronomical Almanach 2003, U.S. Government Printing Office, Washington DC, Her Majesty's Stationery Office, London, p.K9:
t = Ep - 2002
DeltaT/s = 9.2 * t / 15 + 65
Close to the present (1900 to 1987) we use Schmadl and Zech:
t = (Ep - 1900) / 100
DeltaT/d = -0.000020 + 0.000297 * t
+ 0.025184 * t2 - 0.181133 * t3
+ 0.553040 * t4 - 0.861938 * t5
+ 0.677066 * t6 - 0.212591 * t7
This work dates from 1988 and the equation is supposed to be valid only to 1987, but we extend its use into the near future. For the 19th century we use Schmadl and Zech:
t = (Ep - 1900) / 100
DeltaT/d = -0.000009 + 0.003844 * t
+ 0.083563 * t2 + 0.865736 * t3
+ 4.867575 * t4 + 15.845535 * t5
+ 31.332267 * t6 + 38.291999 * t7
+ 28.316289 * t8 + 11.636204 * t9
+ 2.043794 * t10
Stephenson and Houlden are credited with the equations for times before 1600. First for the period 948 to 1600:
t = (Ep - 1850) / 100
DeltaT/s = 22.5 * t2
and before 948:
t = (Ep - 948) / 100
DeltaT/s = 1830 - 405 * t + 46.5 * t2
This leaves no equation for times between 1600 and 1800 and beyond 2015. For such times we use the equation of Morrison and Stephenson:
t = Ep - 1810
DeltaT/s = -15 + 0.00325 * t2
givenMJD
- Modified Julian Date (UT)
public GregorianCalendar getCurrentGregorianCalendar()
public static GregorianCalendar convertJD2Calendar(double jd)
public String convertJD2String(double jd)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |