source: trunk/MagicSoft/slalib/gmsta.c

Last change on this file was 731, checked in by tbretz, 24 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 2.6 KB
Line 
1#include "slalib.h"
2#include "slamac.h"
3double slaGmsta ( double date, double ut )
4/*
5** - - - - - - - - -
6** s l a G m s t a
7** - - - - - - - - -
8**
9** Conversion from Universal Time to Greenwich mean sidereal time,
10** with rounding errors minimized.
11**
12** (double precision)
13**
14** Given:
15* date double UT1 date (MJD: integer part of JD-2400000.5))
16** ut double UT1 time (fraction of a day)
17**
18** The result is the Greenwich Mean Sidereal Time (double precision,
19** radians, in the range 0 to 2pi).
20**
21** There is no restriction on how the UT is apportioned between the
22** date and ut1 arguments. Either of the two arguments could, for
23** example, be zero and the entire date+time supplied in the other.
24** However, the routine is designed to deliver maximum accuracy when
25** the date argument is a whole number and the ut argument lies in
26** the range 0 to 1, or vice versa.
27**
28** The algorithm is based on the IAU 1982 expression (see page S15 of
29** the 1984 Astronomical Almanac). This is always described as giving
30** the GMST at 0 hours UT1. In fact, it gives the difference between
31** the GMST and the UT, the steady 4-minutes-per-day drawing-ahead of
32** ST with respect to UT. When whole days are ignored, the expression
33** happens to equal the GMST at 0 hours UT1 each day.
34**
35** In this routine, the entire UT1 (the sum of the two arguments date
36** and ut) is used directly as the argument for the standard formula.
37** The UT1 is then added, but omitting whole days to conserve accuracy.
38**
39** See also the routine slaGmst, which accepts the UT1 as a single
40** argument. Compared with slaGmst, the extra numerical precision
41** delivered by the present routine is unlikely to be important in
42** an absolute sense, but may be useful when critically comparing
43** algorithms and in applications where two sidereal times close
44** together are differenced.
45**
46** Called: slaDranrm
47**
48** Defined in slamac.h: DS2R, dmod
49**
50** Last revision: 13 April 1998
51**
52** Copyright P.T.Wallace. All rights reserved.
53*/
54{
55 double d1, d2, t;
56
57/* Julian centuries since J2000. */
58 if ( date < ut ) {
59 d1 = date;
60 d2 = ut;
61 } else {
62 d1 = ut;
63 d2 = date;
64 }
65 t = ( d1 + ( d2 - 51544.5 ) ) / 36525.0;
66
67/* GMST at this UT1. */
68 return slaDranrm ( DS2R * ( 24110.54841
69 + ( 8640184.812866
70 + ( 0.093104
71 - 6.2e-6 * t ) * t ) * t
72 + 86400.0 * ( dmod ( d1, 1.0 ) +
73 dmod ( d2, 1.0 ) ) ) );
74}
Note: See TracBrowser for help on using the repository browser.