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

Definition at line 3 of file tdbtcb.c.

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

Referenced by t_tdbtcb().

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 /* TDB to TCB rate */
63  static const double elbb = ERFA_ELB/(1.0-ERFA_ELB);
64 
65  double d, f;
66 
67 /* Result, preserving date format but safeguarding precision. */
68  if ( tdb1 > tdb2 ) {
69  d = t77td - tdb1;
70  f = tdb2 - tdb0;
71  *tcb1 = tdb1;
72  *tcb2 = f - ( d - ( f - t77tf ) ) * elbb;
73  } else {
74  d = t77td - tdb2;
75  f = tdb1 - tdb0;
76  *tcb1 = f + ( d - ( f - t77tf ) ) * elbb;
77  *tcb2 = tdb2;
78  }
79 
80 /* Status (always OK). */
81  return 0;
82 
83 }
#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: