source: trunk/FACT++/pal/palDat.c@ 20115

Last change on this file since 20115 was 18347, checked in by tbretz, 9 years ago
File size: 2.5 KB
Line 
1/*
2*+
3* Name:
4* palDat
5
6* Purpose:
7* Return offset between UTC and TAI
8
9* Language:
10* Starlink ANSI C
11
12* Type of Module:
13* Library routine
14
15* Invocation:
16* dat = palDat( double utc );
17
18* Arguments:
19* utc = double (Given)
20* UTC date as a modified JD (JD-2400000.5)
21
22* Returned Value:
23* dat = double
24* TAI-UTC in seconds
25
26* Description:
27* Increment to be applied to Coordinated Universal Time UTC to give
28* International Atomic Time (TAI).
29
30* Authors:
31* TIMJ: Tim Jenness (JAC, Hawaii)
32* {enter_new_authors_here}
33
34* Notes:
35* - This routine converts the MJD argument to calendar date before calling
36* the SOFA/ERFA eraDat function.
37* - This routine matches the slaDat interface which differs from the eraDat
38* interface. Consider coding directly to the SOFA/ERFA interface.
39* - See eraDat for a description of error conditions when calling this function
40* with a time outside of the UTC range.
41* - The status argument from eraDat is ignored. This is reasonable since the
42* error codes are mainly related to incorrect calendar dates when calculating
43* the JD internally.
44
45* History:
46* 2012-02-08 (TIMJ):
47* Initial version
48* Adapted with permission from the Fortran SLALIB library
49* although the core algorithm is now from SOFA.
50* {enter_further_changes_here}
51
52* Copyright:
53* Copyright (C) 2012 Science and Technology Facilities Council.
54* All Rights Reserved.
55
56* Licence:
57* This program is free software: you can redistribute it and/or
58* modify it under the terms of the GNU Lesser General Public
59* License as published by the Free Software Foundation, either
60* version 3 of the License, or (at your option) any later
61* version.
62*
63* This program is distributed in the hope that it will be useful,
64* but WITHOUT ANY WARRANTY; without even the implied warranty of
65* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
66* GNU Lesser General Public License for more details.
67*
68* You should have received a copy of the GNU Lesser General
69* License along with this program. If not, see
70* <http://www.gnu.org/licenses/>.
71
72* Bugs:
73* {note_any_bugs_here}
74*-
75*/
76
77#include "pal.h"
78#include "palmac.h"
79
80#include "pal1sofa.h"
81
82double palDat ( double dju ) {
83 int iy;
84 int im;
85 int id;
86 int status;
87 double fd;
88 double deltat;
89
90 eraJd2cal( PAL__MJD0, dju,
91 &iy, &im, &id, &fd );
92
93 status = eraDat( iy, im, id, fd, &deltat );
94 return deltat;
95}
Note: See TracBrowser for help on using the repository browser.