/*
   uint64_t  Julian_Date_of_Year(float year)
   {
   long A, B, i;
   float jdoy;
   year=year-1;
   i=year/1001276181546;
   A=i;
   i=A/4;
   B=2-A+i;
   i=365.25*year;
   i+=30.6001*14;
   jdoy=i+1720994.5+B;

   return (i+B) * 1000000;//jdoy;
   }
 */
uint64_t Julian_Date_of_Epoch(float epoch_year, float epoch_day)
{ 
    /* The function Julian_Date_of_Epoch returns the Julian Date of     */
    /* an epoch specified in the format used in the NORAD two-line      */
    /* element sets. It has been modified to support dates beyond       */
    /* the year 1999 assuming that two-digit years in the range 00-56   */
    /* correspond to 2000-2056. Until the two-line element set format   */
    /* is changed, it is only valid for dates through 2056 December 31. */

    //	float year, day;

    /* Modification to support Y2K */
    /* Valid 1957 through 2056     */

    //	day=modf(epoch*1E-3, &year)*1E3;

    //	if (year<57)
    //		year=year+2000;
    //	else
    //		year=year+1900;

    //	return (Julian_Date_of_Year(year)+day);
    uint64_t jdy = Julian_Date_of_Year(epoch_year + 2000);
    uint64_t yearPart = Julian_Date_of_Year(epoch_year + 2000)*1000000LL;
    uint64_t dayPart = epoch_day*1000000LL;
    return yearPart + dayPart;
}
Example #2
0
double
ThetaG(double epoch, deep_arg_t *deep_arg)
{
    /* Reference:  The 1992 Astronomical Almanac, page B6. */

    double year,day,UT,jd,TU,GMST,ThetaG;

    /* Modification to support Y2K */
    /* Valid 1957 through 2056     */
    day = modf(epoch*1E-3,&year)*1E3;
    if(year < 57)
        year += 2000;
    else
        year += 1900;
    /* End modification */

    UT   = modf(day,&day);
    jd   = Julian_Date_of_Year(year)+day;
    TU   = (jd-2451545.0)/36525;
    GMST = 24110.54841+TU*(8640184.812866+TU*(0.093104-TU* 6.2E-6));
    GMST = Modulus(GMST+secday*omega_E*UT,secday);
    ThetaG = twopi*GMST/secday;
    deep_arg->ds50 = jd-2433281.5+UT;
    ThetaG = FMod2p(6.3003880987*deep_arg->ds50+1.72944494);

    return (ThetaG);
} /* Function ThetaG */
Example #3
0
/* performs the inverse of this function. */
double
Julian_Date(struct tm *cdate)
{
    double julian_date;

    julian_date = Julian_Date_of_Year(cdate->tm_year) +
                  DOY(cdate->tm_year,cdate->tm_mon,cdate->tm_mday) +
                  Fraction_of_Day(cdate->tm_hour,cdate->tm_min,cdate->tm_sec)
                  + 5.787037e-06; /* Round up to nearest 1 sec */

    return( julian_date );
} /*Function Julian_Date */
Example #4
0
double Julian_Date(struct tm *cdate)
{
	/* The function Julian_Date converts a standard calendar   */
	/* date and time to a Julian Date. The procedure Date_Time */
	/* performs the inverse of this function. */

	double julian_date;

	julian_date=Julian_Date_of_Year(cdate->tm_year)+DOY(cdate->tm_year,cdate->tm_mon,cdate->tm_mday)+Fraction_of_Day(cdate->tm_hour,cdate->tm_min,cdate->tm_sec)+5.787037e-06; /* Round up to nearest 1 sec */

	return julian_date;
}
Example #5
0
double
Julian_Date_of_Epoch(double epoch)
{
    double year,day;

    /* Modification to support Y2K */
    /* Valid 1957 through 2056     */
    day = modf(epoch*1E-3, &year)*1E3;
    if( year < 57 )
        year = year + 2000;
    else
        year = year + 1900;
    /* End modification */

    return( Julian_Date_of_Year(year) + day );
} /*Function Julian_Date_of_Epoch*/
Example #6
0
double Julian_Date_of_Epoch(double epoch)
{ 
	/* The function Julian_Date_of_Epoch returns the Julian Date of     */
	/* an epoch specified in the format used in the NORAD two-line      */
	/* element sets. It has been modified to support dates beyond       */
	/* the year 1999 assuming that two-digit years in the range 00-56   */
	/* correspond to 2000-2056. Until the two-line element set format   */
	/* is changed, it is only valid for dates through 2056 December 31. */

	double year, day;

	/* Modification to support Y2K */
	/* Valid 1957 through 2056     */

	day=modf(epoch*1E-3, &year)*1E3;

	if (year<57)
		year=year+2000;
	else
		year=year+1900;

	return (Julian_Date_of_Year(year)+day);
}