Ignore:
Timestamp:
Jun 15, 2004, 6:54:12 PM (21 years ago)
Author:
cmv
Message:

nouvelle version de xephem/libastro (3.6) cmv 15/6/04

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaExt/XephemAstroLib/utc_gst.c

    r1719 r2551  
    1 #include "P_.h"
    21#include "astro.h"
    32
    4 static double gmst0 P_((double mjd));
     3static double gmst0 (double mj);
    54
    6 /* given a modified julian date, mjd, and a universally coordinated time, utc,
     5/* given a modified julian date, mj, and a universally coordinated time, utc,
    76 * return greenwich mean siderial time, *gst.
    8  * N.B. mjd must be at the beginning of the day.
     7 * N.B. mj must be at the beginning of the day.
    98 */
    109void
    11 utc_gst (mjd, utc, gst)
    12 double mjd;
    13 double utc;
    14 double *gst;
     10utc_gst (double mj, double utc, double *gst)
    1511{
    16         static double lastmjd = -18981;
     12        static double lastmj = -18981;
    1713        static double t0;
    1814
    19         if (mjd != lastmjd) {
    20             t0 = gmst0(mjd);
    21             lastmjd = mjd;
     15        if (mj != lastmj) {
     16            t0 = gmst0(mj);
     17            lastmj = mj;
    2218        }
    2319        *gst = (1.0/SIDRATE)*utc + t0;
     
    2521}
    2622
    27 /* given a modified julian date, mjd, and a greenwich mean siderial time, gst,
     23/* given a modified julian date, mj, and a greenwich mean siderial time, gst,
    2824 * return universally coordinated time, *utc.
    29  * N.B. mjd must be at the beginning of the day.
     25 * N.B. mj must be at the beginning of the day.
    3026 */
    3127void
    32 gst_utc (mjd, gst, utc)
    33 double mjd;
    34 double gst;
    35 double *utc;
     28gst_utc (double mj, double gst, double *utc)
    3629{
    37         static double lastmjd = -10000;
     30        static double lastmj = -10000;
    3831        static double t0;
    3932
    40         if (mjd != lastmjd) {
    41             t0 = gmst0 (mjd);
    42             lastmjd = mjd;
     33        if (mj != lastmj) {
     34            t0 = gmst0 (mj);
     35            lastmj = mj;
    4336        }
    4437        *utc = gst - t0;
     
    5043 */
    5144static double
    52 gmst0 (mjd)
    53 double mjd;     /* date at 0h UT in julian days since MJD0 */
     45gmst0 (
     46double mj)      /* date at 0h UT in julian days since MJD0 */
    5447{
    5548        double T, x;
    5649
    57         T = ((int)(mjd - 0.5) + 0.5 - J2000)/36525.0;
     50        T = ((int)(mj - 0.5) + 0.5 - J2000)/36525.0;
    5851        x = 24110.54841 +
    5952                (8640184.812866 + (0.093104 - 6.2e-6 * T) * T) * T;
     
    6760/* original routine by elwood; has a secular drift of 0.08s/cty */
    6861static double
    69 tnaught (mjd)
    70 double mjd;     /* julian days since 1900 jan 0.5 */
     62tnaught (mj)
     63double mj;      /* julian days since 1900 jan 0.5 */
    7164{
    72         double dmjd;
     65        double dmj;
    7366        int m, y;
    7467        double d;
    7568        double t, t0;
    7669
    77         mjd_cal (mjd, &m, &d, &y);
    78         cal_mjd (1, 0., y, &dmjd);
    79         t = dmjd/36525;
    80         t0 = 6.57098e-2 * (mjd - dmjd) -
     70        mjd_cal (mj, &m, &d, &y);
     71        cal_mjd (1, 0., y, &dmj);
     72        t = dmj/36525;
     73        t0 = 6.57098e-2 * (mj - dmj) -
    8174             (24 - (6.6460656 + (5.1262e-2 + (t * 2.581e-5))*t) -
    8275                   (2400 * (t - (((double)y - 1900)/100))));
     
    9083  char *argv[];
    9184{
    92         double mjd, gst;
    93         while (scanf("%lf", &mjd) == 1) {
    94                 mjd -= MJD0;
    95                 gst = tnaught(mjd);
    96                 printf("%17.9f %10.7f %10.7f\n", mjd + MJD0, gst, gmst0(mjd));
     85        double mj, gst;
     86        while (scanf("%lf", &mj) == 1) {
     87                mj -= MJD0;
     88                gst = tnaught(mj);
     89                printf("%17.9f %10.7f %10.7f\n", mj + MJD0, gst, gmst0(mj));
    9790        }
    9891}
     
    10093
    10194/* For RCS Only -- Do Not Edit */
    102 static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: utc_gst.c,v $ $Date: 2001-10-22 12:08:28 $ $Revision: 1.2 $ $Name: not supported by cvs2svn $"};
     95static char *rcsid[2] = {(char *)rcsid, "@(#) $RCSfile: utc_gst.c,v $ $Date: 2004-06-15 16:52:41 $ $Revision: 1.3 $ $Name: not supported by cvs2svn $"};
Note: See TracChangeset for help on using the changeset viewer.