FACT++  1.0
int eraTaiutc ( double  tai1,
double  tai2,
double *  utc1,
double *  utc2 
)

Definition at line 3 of file taiutc.c.

References eraUtctai(), and i.

Referenced by t_taiutc().

62 {
63  int big1;
64  int i, j;
65  double a1, a2, u1, u2, g1, g2;
66 
67 /* Put the two parts of the TAI into big-first order. */
68  big1 = ( tai1 >= tai2 );
69  if ( big1 ) {
70  a1 = tai1;
71  a2 = tai2;
72  } else {
73  a1 = tai2;
74  a2 = tai1;
75  }
76 
77 /* Initial guess for UTC. */
78  u1 = a1;
79  u2 = a2;
80 
81 /* Iterate (though in most cases just once is enough). */
82  for ( i = 0; i < 3; i++ ) {
83 
84  /* Guessed UTC to TAI. */
85  j = eraUtctai(u1, u2, &g1, &g2);
86  if ( j < 0 ) return j;
87 
88  /* Adjust guessed UTC. */
89  u2 += a1 - g1;
90  u2 += a2 - g2;
91  }
92 
93 /* Return the UTC result, preserving the TAI order. */
94  if ( big1 ) {
95  *utc1 = u1;
96  *utc2 = u2;
97  } else {
98  *utc1 = u2;
99  *utc2 = u1;
100  }
101 
102 /* Status. */
103  return j;
104 
105 }
int i
Definition: db_dim_client.c:21
int eraUtctai(double utc1, double utc2, double *tai1, double *tai2)
Definition: utctai.c:3

+ Here is the call graph for this function:

+ Here is the caller graph for this function: