line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* |
2
|
|
|
|
|
|
|
*+ |
3
|
|
|
|
|
|
|
* Name: |
4
|
|
|
|
|
|
|
* palDjcal |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
* Purpose: |
7
|
|
|
|
|
|
|
* Modified Julian Date to Gregorian Calendar |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
* Language: |
10
|
|
|
|
|
|
|
* Starlink ANSI C |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
* Type of Module: |
13
|
|
|
|
|
|
|
* Library routine |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
* Invocation: |
16
|
|
|
|
|
|
|
* void palDjcal ( int ndp, double djm, int iymdf[4], int *j ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
* Arguments: |
19
|
|
|
|
|
|
|
* ndp = int (Given) |
20
|
|
|
|
|
|
|
* Number of decimal places of days in fraction. |
21
|
|
|
|
|
|
|
* djm = double (Given) |
22
|
|
|
|
|
|
|
* Modified Julian Date (JD-2400000.5) |
23
|
|
|
|
|
|
|
* iymdf[4] = int[] (Returned) |
24
|
|
|
|
|
|
|
* Year, month, day, fraction in Gregorian calendar. |
25
|
|
|
|
|
|
|
* j = status (Returned) |
26
|
|
|
|
|
|
|
* 0 = OK. See eraJd2cal for other values. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
* Description: |
29
|
|
|
|
|
|
|
* Modified Julian Date to Gregorian Calendar, expressed |
30
|
|
|
|
|
|
|
* in a form convenient for formatting messages (namely |
31
|
|
|
|
|
|
|
* rounded to a specified precision, and with the fields |
32
|
|
|
|
|
|
|
* stored in a single array) |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
* Authors: |
35
|
|
|
|
|
|
|
* PTW: Pat Wallace (STFC) |
36
|
|
|
|
|
|
|
* TIMJ: Tim Jenness (JAC, Hawaii) |
37
|
|
|
|
|
|
|
* {enter_new_authors_here} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
* History: |
40
|
|
|
|
|
|
|
* 2012-02-10 (TIMJ): |
41
|
|
|
|
|
|
|
* Initial version with documentation taken from Fortran SLA |
42
|
|
|
|
|
|
|
* Adapted with permission from the Fortran SLALIB library. |
43
|
|
|
|
|
|
|
* {enter_further_changes_here} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
* Notes: |
46
|
|
|
|
|
|
|
* - Uses eraJd2cal |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
* Copyright: |
49
|
|
|
|
|
|
|
* Copyright (C) 2004 Patrick T. Wallace |
50
|
|
|
|
|
|
|
* Copyright (C) 2012 Science and Technology Facilities Council. |
51
|
|
|
|
|
|
|
* All Rights Reserved. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
* Licence: |
54
|
|
|
|
|
|
|
* This program is free software: you can redistribute it and/or |
55
|
|
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public |
56
|
|
|
|
|
|
|
* License as published by the Free Software Foundation, either |
57
|
|
|
|
|
|
|
* version 3 of the License, or (at your option) any later |
58
|
|
|
|
|
|
|
* version. |
59
|
|
|
|
|
|
|
* |
60
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful, |
61
|
|
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
62
|
|
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
63
|
|
|
|
|
|
|
* GNU Lesser General Public License for more details. |
64
|
|
|
|
|
|
|
* |
65
|
|
|
|
|
|
|
* You should have received a copy of the GNU Lesser General |
66
|
|
|
|
|
|
|
* License along with this program. If not, see |
67
|
|
|
|
|
|
|
* . |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
* Bugs: |
70
|
|
|
|
|
|
|
* {note_any_bugs_here} |
71
|
|
|
|
|
|
|
*- |
72
|
|
|
|
|
|
|
*/ |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
#include |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#include "pal.h" |
77
|
|
|
|
|
|
|
#include "palmac.h" |
78
|
|
|
|
|
|
|
#include "pal1sofa.h" |
79
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
void palDjcal ( int ndp, double djm, int iymdf[4], int *j ) { |
81
|
0
|
|
|
|
|
|
double frac = 0.0; |
82
|
|
|
|
|
|
|
double nfd; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
*j = eraJd2cal( PAL__MJD0, djm, &(iymdf[0]), |
85
|
|
|
|
|
|
|
&(iymdf[1]), &(iymdf[2]), |
86
|
|
|
|
|
|
|
&frac); |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
/* Convert ndp to a power of 10 */ |
89
|
0
|
|
|
|
|
|
nfd = pow( 10., (double)ndp ); |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
/* Multiply the fraction */ |
92
|
0
|
|
|
|
|
|
frac *= nfd; |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
/* and now we want to round to the nearest integer */ |
95
|
0
|
0
|
|
|
|
|
iymdf[3] = (int)DNINT(frac); |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
} |