FACT++  1.0
int eraTcbtdb ( double  tcb1,
double  tcb2,
double *  tdb1,
double *  tdb2 
)

Definition at line 3 of file tcbtdb.c.

References ERFA_DAYSEC, ERFA_DJM0, ERFA_DJM77, ERFA_ELB, ERFA_TDB0, and ERFA_TTMTAI.

Referenced by t_tcbtdb().

53 {
54 
55 /* 1977 Jan 1 00:00:32.184 TT, as two-part JD */
56  static const double t77td = ERFA_DJM0 + ERFA_DJM77;
57  static const double t77tf = ERFA_TTMTAI/ERFA_DAYSEC;
58 
59 /* TDB (days) at TAI 1977 Jan 1.0 */
60  static const double tdb0 = ERFA_TDB0/ERFA_DAYSEC;
61 
62  double d;
63 
64 /* Result, safeguarding precision. */
65  if ( tcb1 > tcb2 ) {
66  d = tcb1 - t77td;
67  *tdb1 = tcb1;
68  *tdb2 = tcb2 + tdb0 - ( d + ( tcb2 - t77tf ) ) * ERFA_ELB;
69  } else {
70  d = tcb2 - t77td;
71  *tdb1 = tcb1 + tdb0 - ( d + ( tcb1 - t77tf ) ) * ERFA_ELB;
72  *tdb2 = tcb2;
73  }
74 
75 /* Status (always OK). */
76  return 0;
77 
78 }
#define ERFA_ELB
Definition: erfam.h:117
#define ERFA_DJM0
Definition: erfam.h:90
#define ERFA_DJM77
Definition: erfam.h:96
#define ERFA_DAYSEC
Definition: erfam.h:75
#define ERFA_TDB0
Definition: erfam.h:118
#define ERFA_TTMTAI
Definition: erfam.h:99

+ Here is the caller graph for this function: