Class JulianTime


First of all think about representing time in your computer. Taking a julian day number for describing today's date and demanding an accuracy of one microsecond for epochs you'll need 7 (day number) plus 5 (seconds per day) plus 6 (microseconds per second) giving 18 decimals. IEEE double arithmetic only supplies 16 decimals. So it seems advisable to split the value and introduce an object consisting of two variables. In order to increase or decrease such time values without loss of accuracy you may define methods plus and minus. In opposition to C++ you have no concept of operator overloading in Java. So you can't simply write

	JulianTime t0, t1, t2;
	t0.now (); t1.set (0, 10.0);
	t2 = t0 + t1;
in order to increase the actual computer time by 10 seconds. You have to write
	JulianTime t0, t1, t2;
	t0.now (); t1.set (0, 10.0);
	t2.set (t0);
	t2.plus (t1);
instead.

Due to time resolution requirements, an object named JulianTime is created. JulianTime represents the continuous flow of time with two variables. One variable shows the julian day number and the other variable gives the seconds of the julian day (remember the start of day at 12am). This way about 10 picoseconds time resolution are possible for epochs (5 decimals for the integer seconds and 11 decimals for the fraction of second).


public class JulianTime

Data of class JulianTime
long julianday;Julian day number (Start 1.1.-4712 12:00:00 a.m.)
double juliansecond;Seconds of (julian) day

Constructors of class JulianTime
public JulianTime ();Initialization with zeroes
public JulianTime (long t, double s);Julian day number, seconds of julian day
public JulianTime (double z);Julian day with fraction of day
public JulianTime (String date, String time);Calendar date and time (european notation, i.e. "14.1.1996", "14:12:11.9")
public JulianTime (JulianTime t);Copy existing JulianTime into newly created one

Methods of class JulianTime
public void now ();Set JulianTime to actual computer date and time
public void set (long t, double s);Set JulianTime to given Julian day and seconds of day or a time span given as days plus seconds
public void set (double z);Set JulianTime to julian day with fraction of day
public void set (String date, String time);Set JulianTime to calendar date and time
public void set (JulianTime t);Set JulianTime to another JulianTime
public void set (int day, int month, long year, int hour, int minute, double second);Set JulianTime to given values
public void normalize ();Force juliansecond to stay within zero and 86400, adjust julianday (mostly used internally)
public double julianDate ();Return julian day with fractional part
public long julianDay ();Return julian day number
public double julianSecond ();Return seconds of julian day
public void plus (JulianTime t);Increase existing JulianTime by t
public void minus (JulianTime t);Decrease existing JulianTime by t
public void julianBesselianDate (String cdate, String ctime);Basic method for converting julian and besselian epochs and calendar date to JulianTime
public long julianDay (long year, int month, int day);Basic method for converting calendar date to julian day number


Back Dieter Egger, (dieter@alpha.fesg.tu-muenchen.de), 1996-09-18