source: branches/FACT++_part_filenames/erfa/src/tdbtcb.c@ 19365

Last change on this file since 19365 was 18711, checked in by tbretz, 8 years ago
Updated to ERFA 1.3.0 (no relevant code change except the leap second at the beginning of 2017)
File size: 5.5 KB
Line 
1#include "erfa.h"
2
3int eraTdbtcb(double tdb1, double tdb2, double *tcb1, double *tcb2)
4/*
5** - - - - - - - - - -
6** e r a T d b t c b
7** - - - - - - - - - -
8**
9** Time scale transformation: Barycentric Dynamical Time, TDB, to
10** Barycentric Coordinate Time, TCB.
11**
12** Given:
13** tdb1,tdb2 double TDB as a 2-part Julian Date
14**
15** Returned:
16** tcb1,tcb2 double TCB as a 2-part Julian Date
17**
18** Returned (function value):
19** int status: 0 = OK
20**
21** Notes:
22**
23** 1) tdb1+tdb2 is Julian Date, apportioned in any convenient way
24** between the two arguments, for example where tdb1 is the Julian
25** Day Number and tdb2 is the fraction of a day. The returned
26** tcb1,tcb2 follow suit.
27**
28** 2) The 2006 IAU General Assembly introduced a conventional linear
29** transformation between TDB and TCB. This transformation
30** compensates for the drift between TCB and terrestrial time TT,
31** and keeps TDB approximately centered on TT. Because the
32** relationship between TT and TCB depends on the adopted solar
33** system ephemeris, the degree of alignment between TDB and TT over
34** long intervals will vary according to which ephemeris is used.
35** Former definitions of TDB attempted to avoid this problem by
36** stipulating that TDB and TT should differ only by periodic
37** effects. This is a good description of the nature of the
38** relationship but eluded precise mathematical formulation. The
39** conventional linear relationship adopted in 2006 sidestepped
40** these difficulties whilst delivering a TDB that in practice was
41** consistent with values before that date.
42**
43** 3) TDB is essentially the same as Teph, the time argument for the
44** JPL solar system ephemerides.
45**
46** Reference:
47**
48** IAU 2006 Resolution B3
49**
50** Copyright (C) 2013-2016, NumFOCUS Foundation.
51** Derived, with permission, from the SOFA library. See notes at end of file.
52*/
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
68/* Result, preserving date format but safeguarding precision. */
69 if ( tdb1 > tdb2 ) {
70 d = t77td - tdb1;
71 f = tdb2 - tdb0;
72 *tcb1 = tdb1;
73 *tcb2 = f - ( d - ( f - t77tf ) ) * elbb;
74 } else {
75 d = t77td - tdb2;
76 f = tdb1 - tdb0;
77 *tcb1 = f + ( d - ( f - t77tf ) ) * elbb;
78 *tcb2 = tdb2;
79 }
80
81/* Status (always OK). */
82 return 0;
83
84}
85/*----------------------------------------------------------------------
86**
87**
88** Copyright (C) 2013-2016, NumFOCUS Foundation.
89** All rights reserved.
90**
91** This library is derived, with permission, from the International
92** Astronomical Union's "Standards of Fundamental Astronomy" library,
93** available from http://www.iausofa.org.
94**
95** The ERFA version is intended to retain identical functionality to
96** the SOFA library, but made distinct through different function and
97** file names, as set out in the SOFA license conditions. The SOFA
98** original has a role as a reference standard for the IAU and IERS,
99** and consequently redistribution is permitted only in its unaltered
100** state. The ERFA version is not subject to this restriction and
101** therefore can be included in distributions which do not support the
102** concept of "read only" software.
103**
104** Although the intent is to replicate the SOFA API (other than
105** replacement of prefix names) and results (with the exception of
106** bugs; any that are discovered will be fixed), SOFA is not
107** responsible for any errors found in this version of the library.
108**
109** If you wish to acknowledge the SOFA heritage, please acknowledge
110** that you are using a library derived from SOFA, rather than SOFA
111** itself.
112**
113**
114** TERMS AND CONDITIONS
115**
116** Redistribution and use in source and binary forms, with or without
117** modification, are permitted provided that the following conditions
118** are met:
119**
120** 1 Redistributions of source code must retain the above copyright
121** notice, this list of conditions and the following disclaimer.
122**
123** 2 Redistributions in binary form must reproduce the above copyright
124** notice, this list of conditions and the following disclaimer in
125** the documentation and/or other materials provided with the
126** distribution.
127**
128** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
129** the International Astronomical Union nor the names of its
130** contributors may be used to endorse or promote products derived
131** from this software without specific prior written permission.
132**
133** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
134** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
135** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
136** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
137** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
138** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
139** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
140** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
141** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
142** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
143** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
144** POSSIBILITY OF SUCH DAMAGE.
145**
146*/
Note: See TracBrowser for help on using the repository browser.