1 #include "sofa.h"
2 #include "sofam.h"
3
iauTaiut1(double tai1,double tai2,double dta,double * ut11,double * ut12)4 int iauTaiut1(double tai1, double tai2, double dta,
5 double *ut11, double *ut12)
6 /*
7 ** - - - - - - - - - -
8 ** i a u T a i u t 1
9 ** - - - - - - - - - -
10 **
11 ** Time scale transformation: International Atomic Time, TAI, to
12 ** Universal Time, UT1.
13 **
14 ** This function is part of the International Astronomical Union's
15 ** SOFA (Standards of Fundamental Astronomy) software collection.
16 **
17 ** Status: canonical.
18 **
19 ** Given:
20 ** tai1,tai2 double TAI as a 2-part Julian Date
21 ** dta double UT1-TAI in seconds
22 **
23 ** Returned:
24 ** ut11,ut12 double UT1 as a 2-part Julian Date
25 **
26 ** Returned (function value):
27 ** int status: 0 = OK
28 **
29 ** Notes:
30 **
31 ** 1) tai1+tai2 is Julian Date, apportioned in any convenient way
32 ** between the two arguments, for example where tai1 is the Julian
33 ** Day Number and tai2 is the fraction of a day. The returned
34 ** UT11,UT12 follow suit.
35 **
36 ** 2) The argument dta, i.e. UT1-TAI, is an observed quantity, and is
37 ** available from IERS tabulations.
38 **
39 ** Reference:
40 **
41 ** Explanatory Supplement to the Astronomical Almanac,
42 ** P. Kenneth Seidelmann (ed), University Science Books (1992)
43 **
44 ** This revision: 2021 May 11
45 **
46 ** SOFA release 2021-05-12
47 **
48 ** Copyright (C) 2021 IAU SOFA Board. See notes at end.
49 **
50 */
51 {
52 double dtad;
53
54
55 /* Result, safeguarding precision. */
56 dtad = dta / DAYSEC;
57 if ( fabs(tai1) > fabs(tai2) ) {
58 *ut11 = tai1;
59 *ut12 = tai2 + dtad;
60 } else {
61 *ut11 = tai1 + dtad;
62 *ut12 = tai2;
63 }
64
65 /* Status (always OK). */
66 return 0;
67
68 /* Finished. */
69
70 /*----------------------------------------------------------------------
71 **
72 ** Copyright (C) 2021
73 ** Standards Of Fundamental Astronomy Board
74 ** of the International Astronomical Union.
75 **
76 ** =====================
77 ** SOFA Software License
78 ** =====================
79 **
80 ** NOTICE TO USER:
81 **
82 ** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
83 ** CONDITIONS WHICH APPLY TO ITS USE.
84 **
85 ** 1. The Software is owned by the IAU SOFA Board ("SOFA").
86 **
87 ** 2. Permission is granted to anyone to use the SOFA software for any
88 ** purpose, including commercial applications, free of charge and
89 ** without payment of royalties, subject to the conditions and
90 ** restrictions listed below.
91 **
92 ** 3. You (the user) may copy and distribute SOFA source code to others,
93 ** and use and adapt its code and algorithms in your own software,
94 ** on a world-wide, royalty-free basis. That portion of your
95 ** distribution that does not consist of intact and unchanged copies
96 ** of SOFA source code files is a "derived work" that must comply
97 ** with the following requirements:
98 **
99 ** a) Your work shall be marked or carry a statement that it
100 ** (i) uses routines and computations derived by you from
101 ** software provided by SOFA under license to you; and
102 ** (ii) does not itself constitute software provided by and/or
103 ** endorsed by SOFA.
104 **
105 ** b) The source code of your derived work must contain descriptions
106 ** of how the derived work is based upon, contains and/or differs
107 ** from the original SOFA software.
108 **
109 ** c) The names of all routines in your derived work shall not
110 ** include the prefix "iau" or "sofa" or trivial modifications
111 ** thereof such as changes of case.
112 **
113 ** d) The origin of the SOFA components of your derived work must
114 ** not be misrepresented; you must not claim that you wrote the
115 ** original software, nor file a patent application for SOFA
116 ** software or algorithms embedded in the SOFA software.
117 **
118 ** e) These requirements must be reproduced intact in any source
119 ** distribution and shall apply to anyone to whom you have
120 ** granted a further right to modify the source code of your
121 ** derived work.
122 **
123 ** Note that, as originally distributed, the SOFA software is
124 ** intended to be a definitive implementation of the IAU standards,
125 ** and consequently third-party modifications are discouraged. All
126 ** variations, no matter how minor, must be explicitly marked as
127 ** such, as explained above.
128 **
129 ** 4. You shall not cause the SOFA software to be brought into
130 ** disrepute, either by misuse, or use for inappropriate tasks, or
131 ** by inappropriate modification.
132 **
133 ** 5. The SOFA software is provided "as is" and SOFA makes no warranty
134 ** as to its use or performance. SOFA does not and cannot warrant
135 ** the performance or results which the user may obtain by using the
136 ** SOFA software. SOFA makes no warranties, express or implied, as
137 ** to non-infringement of third party rights, merchantability, or
138 ** fitness for any particular purpose. In no event will SOFA be
139 ** liable to the user for any consequential, incidental, or special
140 ** damages, including any lost profits or lost savings, even if a
141 ** SOFA representative has been advised of such damages, or for any
142 ** claim by any third party.
143 **
144 ** 6. The provision of any version of the SOFA software under the terms
145 ** and conditions specified herein does not imply that future
146 ** versions will also be made available under the same terms and
147 ** conditions.
148 *
149 ** In any published work or commercial product which uses the SOFA
150 ** software directly, acknowledgement (see www.iausofa.org) is
151 ** appreciated.
152 **
153 ** Correspondence concerning SOFA software should be addressed as
154 ** follows:
155 **
156 ** By email: sofa@ukho.gov.uk
157 ** By post: IAU SOFA Center
158 ** HM Nautical Almanac Office
159 ** UK Hydrographic Office
160 ** Admiralty Way, Taunton
161 ** Somerset, TA1 2DN
162 ** United Kingdom
163 **
164 **--------------------------------------------------------------------*/
165 }
166