source: branches/FACT++_lidctrl_new_eth/erfa/src/tcbtdb.c@ 18795

Last change on this file since 18795 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.4 KB
Line 
1#include "erfa.h"
2
3int eraTcbtdb(double tcb1, double tcb2, double *tdb1, double *tdb2)
4/*
5** - - - - - - - - - -
6** e r a T c b t d b
7** - - - - - - - - - -
8**
9** Time scale transformation: Barycentric Coordinate Time, TCB, to
10** Barycentric Dynamical Time, TDB.
11**
12** Given:
13** tcb1,tcb2 double TCB as a 2-part Julian Date
14**
15** Returned:
16** tdb1,tdb2 double TDB as a 2-part Julian Date
17**
18** Returned (function value):
19** int status: 0 = OK
20**
21** Notes:
22**
23** 1) tcb1+tcb2 is Julian Date, apportioned in any convenient way
24** between the two arguments, for example where tcb1 is the Julian
25** Day Number and tcb2 is the fraction of a day. The returned
26** tdb1,tdb2 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 double d;
63
64
65/* Result, safeguarding precision. */
66 if ( tcb1 > tcb2 ) {
67 d = tcb1 - t77td;
68 *tdb1 = tcb1;
69 *tdb2 = tcb2 + tdb0 - ( d + ( tcb2 - t77tf ) ) * ERFA_ELB;
70 } else {
71 d = tcb2 - t77td;
72 *tdb1 = tcb1 + tdb0 - ( d + ( tcb1 - t77tf ) ) * ERFA_ELB;
73 *tdb2 = tcb2;
74 }
75
76/* Status (always OK). */
77 return 0;
78
79}
80/*----------------------------------------------------------------------
81**
82**
83** Copyright (C) 2013-2016, NumFOCUS Foundation.
84** All rights reserved.
85**
86** This library is derived, with permission, from the International
87** Astronomical Union's "Standards of Fundamental Astronomy" library,
88** available from http://www.iausofa.org.
89**
90** The ERFA version is intended to retain identical functionality to
91** the SOFA library, but made distinct through different function and
92** file names, as set out in the SOFA license conditions. The SOFA
93** original has a role as a reference standard for the IAU and IERS,
94** and consequently redistribution is permitted only in its unaltered
95** state. The ERFA version is not subject to this restriction and
96** therefore can be included in distributions which do not support the
97** concept of "read only" software.
98**
99** Although the intent is to replicate the SOFA API (other than
100** replacement of prefix names) and results (with the exception of
101** bugs; any that are discovered will be fixed), SOFA is not
102** responsible for any errors found in this version of the library.
103**
104** If you wish to acknowledge the SOFA heritage, please acknowledge
105** that you are using a library derived from SOFA, rather than SOFA
106** itself.
107**
108**
109** TERMS AND CONDITIONS
110**
111** Redistribution and use in source and binary forms, with or without
112** modification, are permitted provided that the following conditions
113** are met:
114**
115** 1 Redistributions of source code must retain the above copyright
116** notice, this list of conditions and the following disclaimer.
117**
118** 2 Redistributions in binary form must reproduce the above copyright
119** notice, this list of conditions and the following disclaimer in
120** the documentation and/or other materials provided with the
121** distribution.
122**
123** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
124** the International Astronomical Union nor the names of its
125** contributors may be used to endorse or promote products derived
126** from this software without specific prior written permission.
127**
128** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
129** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
130** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
131** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
132** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
133** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
134** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
135** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
136** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
137** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
138** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
139** POSSIBILITY OF SUCH DAMAGE.
140**
141*/
Note: See TracBrowser for help on using the repository browser.