source: trunk/FACT++/sofa/src/utcut1.c@ 18355

Last change on this file since 18355 was 18346, checked in by tbretz, 11 years ago
File size: 7.3 KB
Line 
1#include "sofa.h"
2
3int iauUtcut1(double utc1, double utc2, double dut1,
4 double *ut11, double *ut12)
5/*
6** - - - - - - - - - -
7** i a u U t c u t 1
8** - - - - - - - - - -
9**
10** Time scale transformation: Coordinated Universal Time, UTC, to
11** Universal Time, UT1.
12**
13** This function is part of the International Astronomical Union's
14** SOFA (Standards of Fundamental Astronomy) software collection.
15**
16** Status: canonical.
17**
18** Given:
19** utc1,utc2 double UTC as a 2-part quasi Julian Date (Notes 1-4)
20** dut1 double Delta UT1 = UT1-UTC in seconds (Note 5)
21**
22** Returned:
23** ut11,ut12 double UT1 as a 2-part Julian Date (Note 6)
24**
25** Returned (function value):
26** int status: +1 = dubious year (Note 3)
27** 0 = OK
28** -1 = unacceptable date
29**
30** Notes:
31**
32** 1) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
33** convenient way between the two arguments, for example where utc1
34** is the Julian Day Number and utc2 is the fraction of a day.
35**
36** 2) JD cannot unambiguously represent UTC during a leap second unless
37** special measures are taken. The convention in the present
38** function is that the JD day represents UTC days whether the
39** length is 86399, 86400 or 86401 SI seconds.
40**
41** 3) The warning status "dubious year" flags UTCs that predate the
42** introduction of the time scale or that are too far in the future
43** to be trusted. See iauDat for further details.
44**
45** 4) The function iauDtf2d converts from calendar date and time of
46** day into 2-part Julian Date, and in the case of UTC implements
47** the leap-second-ambiguity convention described above.
48**
49** 5) Delta UT1 can be obtained from tabulations provided by the
50** International Earth Rotation and Reference Systems Service.
51** It is the caller's responsibility to supply a dut1 argument
52** containing the UT1-UTC value that matches the given UTC.
53**
54** 6) The returned ut11,ut12 are such that their sum is the UT1 Julian
55** Date.
56**
57** References:
58**
59** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
60** IERS Technical Note No. 32, BKG (2004)
61**
62** Explanatory Supplement to the Astronomical Almanac,
63** P. Kenneth Seidelmann (ed), University Science Books (1992)
64**
65** Called:
66** iauJd2cal JD to Gregorian calendar
67** iauDat delta(AT) = TAI-UTC
68** iauUtctai UTC to TAI
69** iauTaiut1 TAI to UT1
70**
71** This revision: 2013 August 12
72**
73** SOFA release 2015-02-09
74**
75** Copyright (C) 2015 IAU SOFA Board. See notes at end.
76*/
77{
78 int iy, im, id, js, jw;
79 double w, dat, dta, tai1, tai2;
80
81/* Look up TAI-UTC. */
82 if ( iauJd2cal(utc1, utc2, &iy, &im, &id, &w) ) return -1;
83 js = iauDat ( iy, im, id, 0.0, &dat);
84 if ( js < 0 ) return -1;
85
86/* Form UT1-TAI. */
87 dta = dut1 - dat;
88
89/* UTC to TAI to UT1. */
90 jw = iauUtctai(utc1, utc2, &tai1, &tai2);
91 if ( jw < 0 ) {
92 return -1;
93 } else if ( jw > 0 ) {
94 js = jw;
95 }
96 if ( iauTaiut1(tai1, tai2, dta, ut11, ut12) ) return -1;
97
98/* Status. */
99 return js;
100
101/*----------------------------------------------------------------------
102**
103** Copyright (C) 2015
104** Standards Of Fundamental Astronomy Board
105** of the International Astronomical Union.
106**
107** =====================
108** SOFA Software License
109** =====================
110**
111** NOTICE TO USER:
112**
113** BY USING THIS SOFTWARE YOU ACCEPT THE FOLLOWING SIX TERMS AND
114** CONDITIONS WHICH APPLY TO ITS USE.
115**
116** 1. The Software is owned by the IAU SOFA Board ("SOFA").
117**
118** 2. Permission is granted to anyone to use the SOFA software for any
119** purpose, including commercial applications, free of charge and
120** without payment of royalties, subject to the conditions and
121** restrictions listed below.
122**
123** 3. You (the user) may copy and distribute SOFA source code to others,
124** and use and adapt its code and algorithms in your own software,
125** on a world-wide, royalty-free basis. That portion of your
126** distribution that does not consist of intact and unchanged copies
127** of SOFA source code files is a "derived work" that must comply
128** with the following requirements:
129**
130** a) Your work shall be marked or carry a statement that it
131** (i) uses routines and computations derived by you from
132** software provided by SOFA under license to you; and
133** (ii) does not itself constitute software provided by and/or
134** endorsed by SOFA.
135**
136** b) The source code of your derived work must contain descriptions
137** of how the derived work is based upon, contains and/or differs
138** from the original SOFA software.
139**
140** c) The names of all routines in your derived work shall not
141** include the prefix "iau" or "sofa" or trivial modifications
142** thereof such as changes of case.
143**
144** d) The origin of the SOFA components of your derived work must
145** not be misrepresented; you must not claim that you wrote the
146** original software, nor file a patent application for SOFA
147** software or algorithms embedded in the SOFA software.
148**
149** e) These requirements must be reproduced intact in any source
150** distribution and shall apply to anyone to whom you have
151** granted a further right to modify the source code of your
152** derived work.
153**
154** Note that, as originally distributed, the SOFA software is
155** intended to be a definitive implementation of the IAU standards,
156** and consequently third-party modifications are discouraged. All
157** variations, no matter how minor, must be explicitly marked as
158** such, as explained above.
159**
160** 4. You shall not cause the SOFA software to be brought into
161** disrepute, either by misuse, or use for inappropriate tasks, or
162** by inappropriate modification.
163**
164** 5. The SOFA software is provided "as is" and SOFA makes no warranty
165** as to its use or performance. SOFA does not and cannot warrant
166** the performance or results which the user may obtain by using the
167** SOFA software. SOFA makes no warranties, express or implied, as
168** to non-infringement of third party rights, merchantability, or
169** fitness for any particular purpose. In no event will SOFA be
170** liable to the user for any consequential, incidental, or special
171** damages, including any lost profits or lost savings, even if a
172** SOFA representative has been advised of such damages, or for any
173** claim by any third party.
174**
175** 6. The provision of any version of the SOFA software under the terms
176** and conditions specified herein does not imply that future
177** versions will also be made available under the same terms and
178** conditions.
179*
180** In any published work or commercial product which uses the SOFA
181** software directly, acknowledgement (see www.iausofa.org) is
182** appreciated.
183**
184** Correspondence concerning SOFA software should be addressed as
185** follows:
186**
187** By email: sofa@ukho.gov.uk
188** By post: IAU SOFA Center
189** HM Nautical Almanac Office
190** UK Hydrographic Office
191** Admiralty Way, Taunton
192** Somerset, TA1 2DN
193** United Kingdom
194**
195**--------------------------------------------------------------------*/
196}
Note: See TracBrowser for help on using the repository browser.