58 #ifdef COSMOS_WIN_BUILD_MSVC 73 #define MJD_UNIX_OFFSET 40587. 74 #define JD_MJD_OFFSET 2400000.5 75 #define MJD2JD(mjd) (double)((mjd) + JD_MJD_OFFSET) 76 #define JD2MJD(jd) (double)((jd) - JD_MJD_OFFSET) 77 #define DAY_TO_SECONDS 86400. 80 #define SECONDS_TO_DAYS(x) ((double)(x) / DAY_TO_SECONDS) 81 #define DAYS_TO_SECONDS(x) ((double)(x) * DAY_TO_SECONDS) 82 #define TIME_SECS_TO_DAYS(x) ((double)(x) / DAY_TO_SECONDS) 83 #define TIME_DAYS_TO_SECS(x) ((double)(x) * DAY_TO_SECONDS) 84 #define TIME_SECS_SINCE_MJD(x) ( ( (currentmjd(0.)-(x)) ) * DAY_TO_SECONDS ) 85 #define TIME_UNIXs_TO_MJD(unixSecs) ( ( (unixSecs) / DAY_TO_SECONDS ) + MJD_UNIX_OFFSET ) // From http://stackoverflow.com/questions/466321/convert-unix-timestamp-to-julian 86 #define TIME_MJD_TO_UNIXs(mjd) (((mjd) - MJD_UNIX_OFFSET) * DAY_TO_SECONDS) // Inverse operation of above 87 #define TIME_UNIX_TV_TO_DOUBLE_SECS(x) ( ((double)(x.tv_sec)) + ((double)(x.tv_usec) / 1000000. ) ) 88 #define UPTIME (DAY_TO_SECONDS*(currentmjd(0.)-mjd_start_time)) 145 double cal2mjd(int32_t
year, int32_t
month=1, int32_t
day=1, int32_t hour=0, int32_t minute=0, int32_t second=0, int32_t nsecond=0);
147 int32_t hour, int32_t minute,
double second);
150 struct timeval
utc2unix(double utc);
182 void gps2week(
double gps, uint32_t& week,
double& seconds);
183 double week2gps(uint32_t week,
double seconds);
193 int32_t *hour, int32_t *minute, int32_t *second);
203 double unix2utc(
struct timeval unixtime);
210 double ranrm(
double angle);
double mjd2jd(double mjd)
Modified Julian Day to Julian Day.
Definition: timelib.cpp:1563
int32_t dom
Definition: timelib.h:110
string mjdToGregorianFormat(double mjd)
Definition: timelib.cpp:1417
double utc2tdb(double mjd)
Convert UTC to TDB.
Definition: timelib.cpp:826
calstruc mjd2cal(double mjd)
MJD to Calendar.
Definition: timelib.cpp:180
double utc2gps(double utc)
Convert UTC to GPS.
Definition: timelib.cpp:925
double utc2dut1(double mjd)
Calculate DUT1.
Definition: timelib.cpp:751
static std::vector< tlestruc > tle
Definition: agent_antenna.cpp:177
double julcen(double mjd)
Julian Century.
Definition: timelib.cpp:815
double utc2era(double mjd)
Earth Rotation Angle.
Definition: timelib.cpp:1027
double utc2theta(double utc)
Precession theta value.
Definition: timelib.cpp:737
double utc2D(double mjd)
Nutation D value.
Definition: timelib.cpp:658
3 element generic row vector
Definition: vector.h:53
double utc2jcenut1(double mjd)
UT1 Julian Century.
Definition: timelib.cpp:488
string seconds2DDHHMMSS(double elapsed_seconds)
Convert Elapsed Time in Seconds to Human Readable Format (used for GPS simulator) ...
Definition: timelib.cpp:1514
double utc2omega(double mjd)
Nutation omega value.
Definition: timelib.cpp:679
int32_t month
Definition: timelib.h:99
int32_t mjdToGregorian(double mjd, int32_t *year, int32_t *month, int32_t *day, int32_t *hour, int32_t *minute, int32_t *second)
Definition: timelib.h:118
double unix2utc(struct timeval unixtime)
Unix time to UTC.
Definition: timelib.cpp:120
int32_t day
Definition: timelib.h:100
double utc2z(double utc)
Precession z value.
Definition: timelib.cpp:720
double ranrm(double angle)
Definition: timelib.cpp:1109
int32_t hour
Definition: timelib.h:112
double fd
Definition: timelib.h:101
double utc2F(double mjd)
Nutation F value.
Definition: timelib.cpp:637
double utc2unixseconds(double utc)
UTC to Unix time.
Definition: timelib.cpp:167
double utc2gast(double mjd)
UTC to GAST.
Definition: timelib.cpp:1048
double utc2jcentt(double mjd)
TT Julian Century.
Definition: timelib.cpp:462
int32_t load_iers()
Load IERS Polar Motion, UT1-UTC, Leap Seconds.
Definition: timelib.cpp:1158
int32_t nsecond
Definition: timelib.h:115
string mjdToGregorianDDMMMYYYY(double mjd)
Definition: timelib.cpp:1442
double iso86012utc(string date)
Definition: timelib.cpp:1305
Definition: timelib.h:106
double tt_mjd
Definition: timelib.h:102
cvector polar_motion(double mjd)
Polar motion.
Definition: timelib.cpp:1221
string utc2unixdate(double utc)
Time for setting unix date.
Definition: timelib.cpp:1260
double set_local_clock(double utc_to)
Definition: timelib.cpp:1626
int32_t month
Definition: timelib.h:109
double utc2L(double mjd)
Nutation L value.
Definition: timelib.cpp:595
double utc2depsilon(double mjd)
Nutation Delta Epsilon value.
Definition: timelib.cpp:552
uint8_t message[300]
Definition: kpc9612p_send.cpp:36
int32_t mjd2ymd(double mjd, int32_t &year, int32_t &month, double &day)
MJD to Year, Month, and Decimal Day (overloaded)
Definition: timelib.cpp:217
double mjd
Definition: timelib.h:97
Headers and definitions common to all COSMOS.
int16_t isleap(int32_t year)
Check for Leap year.
Definition: timelib.cpp:1122
double cal2mjd(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, int32_t second, int32_t nsecond)
Calendar representation to Modified Julian Day - full.
Definition: timelib.cpp:294
double gps2utc(double gps)
Convert GPS to UTC.
Definition: timelib.cpp:946
void gps2week(double gps, uint32_t &week, double &seconds)
GPS Weeks and Seconds from GPS time.
Definition: timelib.cpp:967
string get_local_time()
Definition: timelib.cpp:92
int32_t mjd2tlef(double mjd, string &tle)
Convert mjd to the TLE epoch format.
Definition: timelib.cpp:1613
double jd2mjd(double jd)
Julian Day to Modified Julian Day.
Definition: timelib.cpp:1572
int32_t minute
Definition: timelib.h:113
int32_t timed_countdown(int32_t seconds, int32_t step, string message)
Definition: timelib.cpp:1576
double mjd
Definition: timelib.h:121
struct timeval utc2unix(double utc)
UTC to Unix time.
Definition: timelib.cpp:152
double currentmjd(double offset)
Current UTC in Modified Julian Days.
Definition: timelib.cpp:65
double tt2tdb(double mjd)
Elapsed Time header file.
double mjd2doy(double mjd)
Day of Year from MJD.
Definition: timelib.cpp:1012
string utc2iso8601(double utc)
ISO 8601 version of time.
Definition: timelib.cpp:1286
double utc2epsilon(double mjd)
Nutation Epsilon value.
Definition: timelib.cpp:573
double utc2zeta(double utc)
Precession zeta value.
Definition: timelib.cpp:703
unsigned long int get_unix_time()
Definition: timelib.cpp:86
int32_t year
Definition: timelib.h:108
int32_t year
Definition: timelib.h:98
double gregorianToModJulianDate(int32_t year, int32_t month, int32_t day, int32_t hour, int32_t minute, double second)
Definition: timelib.cpp:448
string mjdToGregorianDDMmmYYYY(double mjd)
Definition: timelib.cpp:1479
double utc2gmst1982(double mjd)
UTC (Modified Julian Day) to GMST.
Definition: timelib.cpp:1075
int32_t second
Definition: timelib.h:114
double week2gps(uint32_t week, double seconds)
GPS Time from GPS Week and Seconds.
Definition: timelib.cpp:983
double utc2ut1(double mjd)
Convert UTC to UT1.
Definition: timelib.cpp:792
rvector utc2nuts(double mjd)
Nutation values.
Definition: timelib.cpp:508
string mjd2iso8601(double mjd)
Definition: timelib.cpp:1316
double gmst_rad
Definition: timelib.h:103
int32_t doy
Definition: timelib.h:111
double utc2dpsi(double mjd)
Nutation Delta Psi value.
Definition: timelib.cpp:531
double utc2Lp(double mjd)
Nutation L prime value.
Definition: timelib.cpp:616
double utc2gmst2000(double utc)
Definition: timelib.cpp:1092
double tt2utc(double mjd)
Convert TT to UTC.
Definition: timelib.cpp:852
int32_t leap_seconds(double mjd)
Leap Seconds.
Definition: timelib.cpp:1193
3 element cartesian vector
Definition: vector.h:107
double utc2tt(double mjd)
Convert UTC to TT.
Definition: timelib.cpp:884
double mjd2year(double mjd)
Year from MJD.
Definition: timelib.cpp:997