source: trunk/FACT++/erfa/src/tttcg.c@ 19128

Last change on this file since 19128 was 18921, checked in by tbretz, 7 years ago
Updated to ERFA 1.4.0
File size: 4.4 KB
Line 
1#include "erfa.h"
2
3int eraTttcg(double tt1, double tt2, double *tcg1, double *tcg2)
4/*
5** - - - - - - - - -
6** e r a T t t c g
7** - - - - - - - - -
8**
9** Time scale transformation: Terrestrial Time, TT, to Geocentric
10** Coordinate Time, TCG.
11**
12** Given:
13** tt1,tt2 double TT as a 2-part Julian Date
14**
15** Returned:
16** tcg1,tcg2 double TCG as a 2-part Julian Date
17**
18** Returned (function value):
19** int status: 0 = OK
20**
21** Note:
22**
23** tt1+tt2 is Julian Date, apportioned in any convenient way between
24** the two arguments, for example where tt1 is the Julian Day Number
25** and tt2 is the fraction of a day. The returned tcg1,tcg2 follow
26** suit.
27**
28** References:
29**
30** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
31** IERS Technical Note No. 32, BKG (2004)
32**
33** IAU 2000 Resolution B1.9
34**
35** Copyright (C) 2013-2017, NumFOCUS Foundation.
36** Derived, with permission, from the SOFA library. See notes at end of file.
37*/
38{
39
40/* 1977 Jan 1 00:00:32.184 TT, as MJD */
41 static const double t77t = ERFA_DJM77 + ERFA_TTMTAI/ERFA_DAYSEC;
42
43/* TT to TCG rate */
44 static const double elgg = ERFA_ELG/(1.0-ERFA_ELG);
45
46
47/* Result, safeguarding precision. */
48 if ( tt1 > tt2 ) {
49 *tcg1 = tt1;
50 *tcg2 = tt2 + ( ( tt1 - ERFA_DJM0 ) + ( tt2 - t77t ) ) * elgg;
51 } else {
52 *tcg1 = tt1 + ( ( tt2 - ERFA_DJM0 ) + ( tt1 - t77t ) ) * elgg;
53 *tcg2 = tt2;
54 }
55
56/* Status (always OK). */
57 return 0;
58
59}
60/*----------------------------------------------------------------------
61**
62**
63** Copyright (C) 2013-2017, NumFOCUS Foundation.
64** All rights reserved.
65**
66** This library is derived, with permission, from the International
67** Astronomical Union's "Standards of Fundamental Astronomy" library,
68** available from http://www.iausofa.org.
69**
70** The ERFA version is intended to retain identical functionality to
71** the SOFA library, but made distinct through different function and
72** file names, as set out in the SOFA license conditions. The SOFA
73** original has a role as a reference standard for the IAU and IERS,
74** and consequently redistribution is permitted only in its unaltered
75** state. The ERFA version is not subject to this restriction and
76** therefore can be included in distributions which do not support the
77** concept of "read only" software.
78**
79** Although the intent is to replicate the SOFA API (other than
80** replacement of prefix names) and results (with the exception of
81** bugs; any that are discovered will be fixed), SOFA is not
82** responsible for any errors found in this version of the library.
83**
84** If you wish to acknowledge the SOFA heritage, please acknowledge
85** that you are using a library derived from SOFA, rather than SOFA
86** itself.
87**
88**
89** TERMS AND CONDITIONS
90**
91** Redistribution and use in source and binary forms, with or without
92** modification, are permitted provided that the following conditions
93** are met:
94**
95** 1 Redistributions of source code must retain the above copyright
96** notice, this list of conditions and the following disclaimer.
97**
98** 2 Redistributions in binary form must reproduce the above copyright
99** notice, this list of conditions and the following disclaimer in
100** the documentation and/or other materials provided with the
101** distribution.
102**
103** 3 Neither the name of the Standards Of Fundamental Astronomy Board,
104** the International Astronomical Union nor the names of its
105** contributors may be used to endorse or promote products derived
106** from this software without specific prior written permission.
107**
108** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
109** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
110** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
111** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
112** COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
113** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
114** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
115** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
116** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
117** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
118** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
119** POSSIBILITY OF SUCH DAMAGE.
120**
121*/
Note: See TracBrowser for help on using the repository browser.