source: trunk/MagicSoft/slalib/dat.c@ 9472

Last change on this file since 9472 was 9222, checked in by tbretz, 16 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 4.8 KB
Line 
1#include "slalib.h"
2#include "slamac.h"
3double slaDat ( double utc )
4/*
5** - - - - - - -
6** s l a D a t
7** - - - - - - -
8**
9** Increment to be applied to Coordinated Universal Time UTC to give
10** International Atomic Time TAI.
11**
12** (double precision)
13**
14** Given:
15** utc double UTC date as a modified JD (JD-2400000.5)
16**
17** Result: TAI-UTC in seconds
18**
19** Notes:
20**
21** 1 The UTC is specified to be a date rather than a time to indicate
22** that care needs to be taken not to specify an instant which lies
23** within a leap second. Though in most cases the utc argument can
24** include the fractional part, correct behaviour on the day of a
25** leap second can only be guaranteed up to the end of the second
26** 23:59:59.
27**
28** 2 For epochs from 1961 January 1 onwards, the expressions from the
29** file ftp://maia.usno.navy.mil/ser7/tai-utc.dat are used.
30**
31** 3 The 5ms timestep at 1961 January 1 is taken from 2.58.1 (p87) of
32** the 1992 Explanatory Supplement.
33**
34** 4 UTC began at 1960 January 1.0 (JD 2436934.5) and it is improper
35** to call the routine with an earlier epoch. However, if this
36** is attempted, the TAI-UTC expression for the year 1960 is used.
37**
38** :-----------------------------------------:
39** : :
40** : IMPORTANT :
41** : :
42** : This routine must be updated on each :
43** : occasion that a leap second is :
44** : announced :
45** : :
46** : Latest leap second: 2009 January 1 :
47** : :
48** :-----------------------------------------:
49**
50** Last revision: 31 May 1999
51**
52** Copyright 1999 P.T.Wallace. All rights reserved.
53*/
54{
55
56/* - - - - - - - - - - - - - - - - - - - - - */
57/* Add new code here on each occasion that a */
58/* leap second is announced, and also update */
59/* the preamble comments appropriately. */
60/* - - - - - - - - - - - - - - - - - - - - - */
61
62/* 2009 January 1 */
63 if ( utc >= 54832.0 ) return 34.0;
64
65/* 2006 January 1 */
66 if ( utc >= 53736.0 ) return 33.0;
67
68/* 1999 January 1 */
69 if ( utc >= 51179.0 ) return 32.0;
70
71/* 1997 July 1 */
72 if ( utc >= 50630.0 ) return 31.0;
73
74/* 1996 January 1 */
75 if ( utc >= 50083.0 ) return 30.0;
76
77/* 1994 July 1 */
78 if ( utc >= 49534.0 ) return 29.0;
79
80/* 1993 July 1 */
81 if ( utc >= 49169.0 ) return 28.0;
82
83/* 1992 July 1 */
84 if ( utc >= 48804.0 ) return 27.0;
85
86/* 1991 January 1 */
87 if ( utc >= 48257.0 ) return 26.0;
88
89/* 1990 January 1 */
90 if ( utc >= 47892.0 ) return 25.0;
91
92/* 1988 January 1 */
93 if ( utc >= 47161.0 ) return 24.0;
94
95/* 1985 July 1 */
96 if ( utc >= 46247.0 ) return 23.0;
97
98/* 1983 July 1 */
99 if ( utc >= 45516.0 ) return 22.0;
100
101/* 1982 July 1 */
102 if ( utc >= 45151.0 ) return 21.0;
103
104/* 1981 July 1 */
105 if ( utc >= 44786.0 ) return 20.0;
106
107/* 1980 January 1 */
108 if ( utc >= 44239.0 ) return 19.0;
109
110/* 1979 January 1 */
111 if ( utc >= 43874.0 ) return 18.0;
112
113/* 1978 January 1 */
114 if ( utc >= 43509.0 ) return 17.0;
115
116/* 1977 January 1 */
117 if ( utc >= 43144.0 ) return 16.0;
118
119/* 1976 January 1 */
120 if ( utc >= 42778.0 ) return 15.0;
121
122/* 1975 January 1 */
123 if ( utc >= 42413.0 ) return 14.0;
124
125/* 1974 January 1 */
126 if ( utc >= 42048.0 ) return 13.0;
127
128/* 1973 January 1 */
129 if ( utc >= 41683.0 ) return 12.0;
130
131/* 1972 July 1 */
132 if ( utc >= 41499.0 ) return 11.0;
133
134/* 1972 January 1 */
135 if ( utc >= 41317.0 ) return 10.0;
136
137/* 1968 February 1 */
138 if ( utc >= 39887.0 ) return 4.2131700 + ( utc - 39126.0 ) * 0.002592;
139
140/* 1966 January 1 */
141 if ( utc >= 39126.0 ) return 4.3131700 + ( utc - 39126.0 ) * 0.002592;
142
143/* 1965 September 1 */
144 if ( utc >= 39004.0 ) return 3.8401300 + ( utc - 38761.0 ) * 0.001296;
145
146/* 1965 July 1 */
147 if ( utc >= 38942.0 ) return 3.7401300 + ( utc - 38761.0 ) * 0.001296;
148
149/* 1965 March 1 */
150 if ( utc >= 38820.0 ) return 3.6401300 + ( utc - 38761.0 ) * 0.001296;
151
152/* 1965 January 1 */
153 if ( utc >= 38761.0 ) return 3.5401300 + ( utc - 38761.0 ) * 0.001296;
154
155/* 1964 September 1 */
156 if ( utc >= 38639.0 ) return 3.4401300 + ( utc - 38761.0 ) * 0.001296;
157
158/* 1964 April 1 */
159 if ( utc >= 38486.0 ) return 3.3401300 + ( utc - 38761.0 ) * 0.001296;
160
161/* 1964 January 1 */
162 if ( utc >= 38395.0 ) return 3.2401300 + ( utc - 38761.0 ) * 0.001296;
163
164/* 1963 November 1 */
165 if ( utc >= 38334.0 ) return 1.9458580 + ( utc - 37665.0 ) * 0.0011232;
166
167/* 1962 January 1 */
168 if ( utc >= 37665.0 ) return 1.8458580 + ( utc - 37665.0 ) * 0.0011232;
169
170/* 1961 August 1 */
171 if ( utc >= 37512.0 ) return 1.3728180 + ( utc - 37300.0 ) * 0.001296;
172
173/* 1961 January 1 */
174 if ( utc >= 37300.0 ) return 1.4228180 + ( utc - 37300.0 ) * 0.001296;
175
176/* Before that. */
177 return 1.4178180 + ( utc - 37300.0 ) * 0.001296;
178
179}
Note: See TracBrowser for help on using the repository browser.