home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Education
/
collectionofeducationcarat1997.iso
/
SCIENCE
/
AA_51.ZIP
/
SIDRLT.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-02-09
|
2KB
|
74 lines
/* Local Apparent Sidereal Time with equation of the equinoxes
* AA page B6
*
* Caution. At epoch J2000.0, the 16 decimal precision
* of IEEE double precision numbers
* limits time resolution measured by Julian date
* to approximately 24 microseconds.
*/
extern double J2000, TDT, RTD, nutl, coseps;
double floor();
int nutlo(), epsiln();
/* program returns sidereal seconds since sidereal midnight */
double sidrlt( j, tlong )
double j; /* Julian date and fraction */
double tlong; /* East longitude of observer, degrees */
{
double jd0; /* Julian day at midnight Universal Time */
double secs; /* Time of day, UT seconds since UT midnight */
double eqeq, gmst, jd, T0, T, msday;
/*long il;*/
/* Julian day at given UT */
jd = j;
jd0 = floor(jd);
secs = j - jd0;
if( secs < 0.5 )
{
jd0 -= 0.5;
secs += 0.5;
}
else
{
jd0 += 0.5;
secs -= 0.5;
}
secs *= 86400.0;
/* Julian centuries from standard epoch J2000.0 */
T = (jd - J2000)/36525.0;
/* Same but at 0h Universal Time of date */
T0 = (jd0 - J2000)/36525.0;
/* The equation of the equinoxes is the nutation in longitude
* times the cosine of the obliquity of the ecliptic.
* We already have routines for these. Using the nutation formula
* given by Meeus, the peak error in 1986 is 5 milliseconds.
*/
nutlo(TDT);
epsiln(TDT);
/* nutl is in radians; convert to seconds of time
* at 240 seconds per degree
*/
eqeq = 240.0 * RTD * nutl * coseps;
/* Greenwich Mean Sidereal Time at 0h UT of date */
gmst = (( -6.2e-6*T0 + 9.3104e-2)*T0 + 8640184.812866)*T0 + 24110.54841;
/* mean solar days per sidereal day at date T0, = 1.00273790934 in 1986 */
msday = 1.0 + ((-1.86e-5*T0 + 0.186208)*T0 + 8640184.812866)/(86400.*36525.);
/* Local apparent sidereal time at given UT */
gmst = gmst + msday*secs + eqeq + 240.0*tlong;
/* Sidereal seconds modulo 1 sidereal day */
gmst = gmst - 86400.0 * floor( gmst/86400.0 );
/*
* il = gmst/86400.0;
* gmst = gmst - 86400.0 * il;
* if( gmst < 0.0 )
* gmst += 86400.0;
*/
return( gmst );
}