Last change
on this file since 5468 was 731, checked in by tbretz, 24 years ago |
*** empty log message ***
|
-
Property svn:executable
set to
*
|
File size:
1.4 KB
|
Line | |
---|
1 | #include "slalib.h"
|
---|
2 | #include "slamac.h"
|
---|
3 | void slaDtf2d ( int ihour, int imin, double sec, double *days, int *j )
|
---|
4 | /*
|
---|
5 | ** - - - - - - - - -
|
---|
6 | ** s l a D t f 2 d
|
---|
7 | ** - - - - - - - - -
|
---|
8 | **
|
---|
9 | ** Convert hours, minutes, seconds to days.
|
---|
10 | **
|
---|
11 | ** (double precision)
|
---|
12 | **
|
---|
13 | ** Given:
|
---|
14 | ** ihour int hours
|
---|
15 | ** imin int minutes
|
---|
16 | ** sec double seconds
|
---|
17 | **
|
---|
18 | ** Returned:
|
---|
19 | ** *days double interval in days
|
---|
20 | ** *j int status: 0 = OK
|
---|
21 | ** 1 = ihour outside range 0-23
|
---|
22 | ** 2 = imin outside range 0-59
|
---|
23 | ** 3 = sec outside range 0-59.999...
|
---|
24 | **
|
---|
25 | ** Notes:
|
---|
26 | **
|
---|
27 | ** 1) The result is computed even if any of the range checks fail.
|
---|
28 | **
|
---|
29 | ** 2) The sign must be dealt with outside this routine.
|
---|
30 | **
|
---|
31 | ** Last revision: 31 January 1997
|
---|
32 | **
|
---|
33 | ** Copyright P.T.Wallace. All rights reserved.
|
---|
34 | */
|
---|
35 |
|
---|
36 | /* Seconds per day */
|
---|
37 | #define D2S 86400.0
|
---|
38 |
|
---|
39 | {
|
---|
40 | /* Preset status */
|
---|
41 | *j = 0;
|
---|
42 |
|
---|
43 | /* Validate sec, min, hour */
|
---|
44 | if ( ( sec < 0.0 ) || ( sec >= 60.0 ) ) {
|
---|
45 | *j = 3;
|
---|
46 | return;
|
---|
47 | }
|
---|
48 | if ( ( imin < 0 ) || ( imin > 59 ) ) {
|
---|
49 | *j = 2;
|
---|
50 | return;
|
---|
51 | }
|
---|
52 | if ( ( ihour < 0 ) || ( ihour > 23 ) ) {
|
---|
53 | *j = 1;
|
---|
54 | return;
|
---|
55 | }
|
---|
56 |
|
---|
57 | /* Compute interval */
|
---|
58 | *days = ( 60.0 * ( 60.0 * (double) ihour + (double) imin ) + sec ) / D2S;
|
---|
59 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.