view release on metacpan or search on metacpan
erfasrc/src/apco13.c view on Meta::CPAN
** 1) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
** convenient way between the two arguments, for example where utc1
** is the Julian Day Number and utc2 is the fraction of a day.
**
** However, JD cannot unambiguously represent UTC during a leap
** second unless special measures are taken. The convention in the
** present function is that the JD day represents UTC days whether
** the length is 86399, 86400 or 86401 SI seconds.
**
** Applications should use the function eraDtf2d to convert from
** calendar date and time of day into 2-part quasi Julian Date, as
** it implements the leap-second-ambiguity convention just
** described.
**
** 2) The warning status "dubious year" flags UTCs that predate the
** introduction of the time scale or that are too far in the
** future to be trusted. See eraDat for further details.
**
** 3) UT1-UTC is tabulated in IERS bulletins. It increases by exactly
** one second at the end of each positive UTC leap second,
** introduced in order to keep UT1-UTC within +/- 0.9s. n.b. This
erfasrc/src/apio13.c view on Meta::CPAN
** 1) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
** convenient way between the two arguments, for example where utc1
** is the Julian Day Number and utc2 is the fraction of a day.
**
** However, JD cannot unambiguously represent UTC during a leap
** second unless special measures are taken. The convention in the
** present function is that the JD day represents UTC days whether
** the length is 86399, 86400 or 86401 SI seconds.
**
** Applications should use the function eraDtf2d to convert from
** calendar date and time of day into 2-part quasi Julian Date, as
** it implements the leap-second-ambiguity convention just
** described.
**
** 2) The warning status "dubious year" flags UTCs that predate the
** introduction of the time scale or that are too far in the future
** to be trusted. See eraDat for further details.
**
** 3) UT1-UTC is tabulated in IERS bulletins. It increases by exactly
** one second at the end of each positive UTC leap second,
** introduced in order to keep UT1-UTC within +/- 0.9s. n.b. This
erfasrc/src/atco13.c view on Meta::CPAN
** 3) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
** convenient way between the two arguments, for example where utc1
** is the Julian Day Number and utc2 is the fraction of a day.
**
** However, JD cannot unambiguously represent UTC during a leap
** second unless special measures are taken. The convention in the
** present function is that the JD day represents UTC days whether
** the length is 86399, 86400 or 86401 SI seconds.
**
** Applications should use the function eraDtf2d to convert from
** calendar date and time of day into 2-part quasi Julian Date, as
** it implements the leap-second-ambiguity convention just
** described.
**
** 4) The warning status "dubious year" flags UTCs that predate the
** introduction of the time scale or that are too far in the
** future to be trusted. See eraDat for further details.
**
** 5) UT1-UTC is tabulated in IERS bulletins. It increases by exactly
** one second at the end of each positive UTC leap second,
** introduced in order to keep UT1-UTC within +/- 0.9s. n.b. This
erfasrc/src/atio13.c view on Meta::CPAN
** 1) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
** convenient way between the two arguments, for example where utc1
** is the Julian Day Number and utc2 is the fraction of a day.
**
** However, JD cannot unambiguously represent UTC during a leap
** second unless special measures are taken. The convention in the
** present function is that the JD day represents UTC days whether
** the length is 86399, 86400 or 86401 SI seconds.
**
** Applications should use the function eraDtf2d to convert from
** calendar date and time of day into 2-part quasi Julian Date, as
** it implements the leap-second-ambiguity convention just
** described.
**
** 2) The warning status "dubious year" flags UTCs that predate the
** introduction of the time scale or that are too far in the
** future to be trusted. See eraDat for further details.
**
** 3) UT1-UTC is tabulated in IERS bulletins. It increases by exactly
** one second at the end of each positive UTC leap second,
** introduced in order to keep UT1-UTC within +/- 0.9s. n.b. This
erfasrc/src/atoc13.c view on Meta::CPAN
** 3) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
** convenient way between the two arguments, for example where utc1
** is the Julian Day Number and utc2 is the fraction of a day.
**
** However, JD cannot unambiguously represent UTC during a leap
** second unless special measures are taken. The convention in the
** present function is that the JD day represents UTC days whether
** the length is 86399, 86400 or 86401 SI seconds.
**
** Applications should use the function eraDtf2d to convert from
** calendar date and time of day into 2-part quasi Julian Date, as
** it implements the leap-second-ambiguity convention just
** described.
**
** 4) The warning status "dubious year" flags UTCs that predate the
** introduction of the time scale or that are too far in the
** future to be trusted. See eraDat for further details.
**
** 5) UT1-UTC is tabulated in IERS bulletins. It increases by exactly
** one second at the end of each positive UTC leap second,
** introduced in order to keep UT1-UTC within +/- 0.9s. n.b. This
erfasrc/src/atoi13.c view on Meta::CPAN
** 3) utc1+utc2 is quasi Julian Date (see Note 2), apportioned in any
** convenient way between the two arguments, for example where utc1
** is the Julian Day Number and utc2 is the fraction of a day.
**
** However, JD cannot unambiguously represent UTC during a leap
** second unless special measures are taken. The convention in the
** present function is that the JD day represents UTC days whether
** the length is 86399, 86400 or 86401 SI seconds.
**
** Applications should use the function eraDtf2d to convert from
** calendar date and time of day into 2-part quasi Julian Date, as
** it implements the leap-second-ambiguity convention just
** described.
**
** 4) The warning status "dubious year" flags UTCs that predate the
** introduction of the time scale or that are too far in the
** future to be trusted. See eraDat for further details.
**
** 5) UT1-UTC is tabulated in IERS bulletins. It increases by exactly
** one second at the end of each positive UTC leap second,
** introduced in order to keep UT1-UTC within +/- 0.9s. n.b. This
erfasrc/src/cal2jd.c view on Meta::CPAN
int eraCal2jd(int iy, int im, int id, double *djm0, double *djm)
/*
** - - - - - - - - - -
** e r a C a l 2 j d
** - - - - - - - - - -
**
** Gregorian Calendar to Julian Date.
**
** Given:
** iy,im,id int year, month, day in Gregorian calendar (Note 1)
**
** Returned:
** djm0 double MJD zero-point: always 2400000.5
** djm double Modified Julian Date for 0 hrs
**
** Returned (function value):
** int status:
** 0 = OK
** -1 = bad year (Note 3: JD not computed)
** -2 = bad month (JD not computed)
erfasrc/src/d2dtf.c view on Meta::CPAN
**
** Format for output a 2-part Julian Date (or in the case of UTC a
** quasi-JD form that includes special provision for leap seconds).
**
** Given:
** scale char[] time scale ID (Note 1)
** ndp int resolution (Note 2)
** d1,d2 double time as a 2-part Julian Date (Notes 3,4)
**
** Returned:
** iy,im,id int year, month, day in Gregorian calendar (Note 5)
** ihmsf int[4] hours, minutes, seconds, fraction (Note 1)
**
** Returned (function value):
** int status: +1 = dubious year (Note 5)
** 0 = OK
** -1 = unacceptable date (Note 6)
**
** Notes:
**
** 1) scale identifies the time scale. Only the value "UTC" (in upper
erfasrc/src/d2dtf.c view on Meta::CPAN
** the quasi-JD day represents UTC days whether the length is 86399,
** 86400 or 86401 SI seconds. In the 1960-1972 era there were
** smaller jumps (in either direction) each time the linear UTC(TAI)
** expression was changed, and these "mini-leaps" are also included
** in the ERFA convention.
**
** 5) The warning status "dubious year" flags UTCs that predate the
** introduction of the time scale or that are too far in the future
** to be trusted. See eraDat for further details.
**
** 6) For calendar conventions and limitations, see eraCal2jd.
**
** Called:
** eraJd2cal JD to Gregorian calendar
** eraD2tf decompose days to hms
** eraDat delta(AT) = TAI-UTC
**
** Copyright (C) 2013-2020, NumFOCUS Foundation.
** Derived, with permission, from the SOFA library. See notes at end of file.
*/
{
int leap;
char s;
int iy1, im1, id1, js, iy2, im2, id2, ihmsf1[4], i;
double a1, b1, fd, dat0, dat12, w, dat24, dleap;
/* The two-part JD. */
a1 = d1;
b1 = d2;
/* Provisional calendar date. */
js = eraJd2cal(a1, b1, &iy1, &im1, &id1, &fd);
if ( js ) return -1;
/* Is this a leap second day? */
leap = 0;
if ( ! strcmp(scale,"UTC") ) {
/* TAI-UTC at 0h today. */
js = eraDat(iy1, im1, id1, 0.0, &dat0);
if ( js < 0 ) return -1;
erfasrc/src/d2dtf.c view on Meta::CPAN
leap = (dleap != 0.0);
if (leap) fd += fd * dleap/ERFA_DAYSEC;
}
/* Provisional time of day. */
eraD2tf ( ndp, fd, &s, ihmsf1 );
/* Has the (rounded) time gone past 24h? */
if ( ihmsf1[0] > 23 ) {
/* Yes. We probably need tomorrow's calendar date. */
js = eraJd2cal(a1+1.5, b1-fd, &iy2, &im2, &id2, &w);
if ( js ) return -1;
/* Is today a leap second day? */
if ( ! leap ) {
/* No. Use 0h tomorrow. */
iy1 = iy2;
im1 = im2;
id1 = id2;
erfasrc/src/dat.c view on Meta::CPAN
** For both too-early and too-late years, the warning status is +1.
** This is distinct from the error status -1, which signifies a year
** so early that JD could not be computed.
**
** 2) If the specified date is for a day which ends with a leap second,
** the TAI-UTC value returned is for the period leading up to the
** leap second. If the date is for a day which begins as a leap
** second ends, the TAI-UTC returned is for the period following the
** leap second.
**
** 3) The day number must be in the normal calendar range, for example
** 1 through 30 for April. The "almanac" convention of allowing
** such dates as January 0 and December 32 is not supported in this
** function, in order to avoid confusion near leap seconds.
**
** 4) The fraction of day is used only for dates before the
** introduction of leap seconds, the first of which occurred at the
** end of 1971. It is tested for validity (0 to 1 is the valid
** range) even if not used; if invalid, zero is used and status -4
** is returned. For many applications, setting fd to zero is
** acceptable; the resulting error is always less than 3 ms (and
erfasrc/src/dat.c view on Meta::CPAN
**
** References:
**
** 1) For dates from 1961 January 1 onwards, the expressions from the
** file ftp://maia.usno.navy.mil/ser7/tai-utc.dat are used.
**
** 2) The 5ms timestep at 1961 January 1 is taken from 2.58.1 (p87) of
** the 1992 Explanatory Supplement.
**
** Called:
** eraCal2jd Gregorian calendar to JD
**
** Copyright (C) 2013-2020, NumFOCUS Foundation.
** Derived, with permission, from the SOFA library. See notes at end of file.
*/
{
/* Release year for this version of eraDat */
enum { IYV = 2020};
/* Reference dates (MJD) and drift rates (s/day), pre leap seconds */
static const double drift[][2] = {
erfasrc/src/dtf2d.c view on Meta::CPAN
** - - - - - - - - -
** e r a D t f 2 d
** - - - - - - - - -
**
** Encode date and time fields into 2-part Julian Date (or in the case
** of UTC a quasi-JD form that includes special provision for leap
** seconds).
**
** Given:
** scale char[] time scale ID (Note 1)
** iy,im,id int year, month, day in Gregorian calendar (Note 2)
** ihr,imn int hour, minute
** sec double seconds
**
** Returned:
** d1,d2 double 2-part Julian Date (Notes 3,4)
**
** Returned (function value):
** int status: +3 = both of next two
** +2 = time is after end of day (Note 5)
** +1 = dubious year (Note 6)
erfasrc/src/dtf2d.c view on Meta::CPAN
** -4 = bad hour
** -5 = bad minute
** -6 = bad second (<0)
**
** Notes:
**
** 1) scale identifies the time scale. Only the value "UTC" (in upper
** case) is significant, and enables handling of leap seconds (see
** Note 4).
**
** 2) For calendar conventions and limitations, see eraCal2jd.
**
** 3) The sum of the results, d1+d2, is Julian Date, where normally d1
** is the Julian Day Number and d2 is the fraction of a day. In the
** case of UTC, where the use of JD is problematical, special
** conventions apply: see the next note.
**
** 4) JD cannot unambiguously represent UTC during a leap second unless
** special measures are taken. The ERFA internal convention is that
** the quasi-JD day represents UTC days whether the length is 86399,
** 86400 or 86401 SI seconds. In the 1960-1972 era there were
erfasrc/src/dtf2d.c view on Meta::CPAN
** to be trusted. See eraDat for further details.
**
** 7) Only in the case of continuous and regular time scales (TAI, TT,
** TCG, TCB and TDB) is the result d1+d2 a Julian Date, strictly
** speaking. In the other cases (UT1 and UTC) the result must be
** used with circumspection; in particular the difference between
** two such results cannot be interpreted as a precise time
** interval.
**
** Called:
** eraCal2jd Gregorian calendar to JD
** eraDat delta(AT) = TAI-UTC
** eraJd2cal JD to Gregorian calendar
**
** Copyright (C) 2013-2020, NumFOCUS Foundation.
** Derived, with permission, from the SOFA library. See notes at end of file.
*/
{
int js, iy2, im2, id2;
double dj, w, day, seclim, dat0, dat12, dat24, dleap, time;
/* Today's Julian Day Number. */
erfasrc/src/jd2cal.c view on Meta::CPAN
** 2450123.7 0.0 (JD method)
** 2451545.0 -1421.3 (J2000 method)
** 2400000.5 50123.2 (MJD method)
** 2450123.5 0.2 (date & time method)
**
** Separating integer and fraction uses the "compensated summation"
** algorithm of Kahan-Neumaier to preserve as much precision as
** possible irrespective of the jd1+jd2 apportionment.
**
** 3) In early eras the conversion is from the "proleptic Gregorian
** calendar"; no account is taken of the date(s) of adoption of
** the Gregorian calendar, nor is the AD/BC numbering convention
** observed.
**
** References:
**
** Explanatory Supplement to the Astronomical Almanac,
** P. Kenneth Seidelmann (ed), University Science Books (1992),
** Section 12.92 (p604).
**
** Klein, A., A Generalized Kahan-Babuska-Summation-Algorithm.
** Computing 76, 279-293 (2006), Section 3.
erfasrc/src/jd2cal.c view on Meta::CPAN
t = s - 1.0;
cs += (s-t) - 1.0;
s = t;
f = s + cs;
if ( -DBL_EPSILON/2.0 < f ) {
jd++;
f = ERFA_GMAX(f, 0.0);
}
}
/* Express day in Gregorian calendar. */
l = jd + 68569L;
n = (4L * l) / 146097L;
l -= (146097L * n + 3L) / 4L;
i = (4000L * (l + 1L)) / 1461001L;
l -= (1461L * i) / 4L - 31L;
k = (80L * l) / 2447L;
*id = (int) (l - (2447L * k) / 80L);
l = k / 11L;
*im = (int) (k + 2L - 12L * l);
*iy = (int) (100L * (n - 49L) + i + l);
erfasrc/src/jdcalf.c view on Meta::CPAN
**
** Julian Date to Gregorian Calendar, expressed in a form convenient
** for formatting messages: rounded to a specified precision.
**
** Given:
** ndp int number of decimal places of days in fraction
** dj1,dj2 double dj1+dj2 = Julian Date (Note 1)
**
** Returned:
** iymdf int[4] year, month, day, fraction in Gregorian
** calendar
**
** Returned (function value):
** int status:
** -1 = date out of range
** 0 = OK
** +1 = NDP not 0-9 (interpreted as 0)
**
** Notes:
**
** 1) The Julian Date is apportioned in any convenient way between
erfasrc/src/jdcalf.c view on Meta::CPAN
** Calendar"; no account is taken of the date(s) of adoption of
** the Gregorian Calendar, nor is the AD/BC numbering convention
** observed.
**
** 3) Refer to the function eraJd2cal.
**
** 4) NDP should be 4 or less if internal overflows are to be
** avoided on machines which use 16-bit integers.
**
** Called:
** eraJd2cal JD to Gregorian calendar
**
** Reference:
**
** Explanatory Supplement to the Astronomical Almanac,
** P. Kenneth Seidelmann (ed), University Science Books (1992),
** Section 12.92 (p604).
**
** Copyright (C) 2013-2020, NumFOCUS Foundation.
** Derived, with permission, from the SOFA library. See notes at end of file.
*/
erfasrc/src/jdcalf.c view on Meta::CPAN
d -= 1.0;
}
djd += d;
/* Round the total fraction to the specified number of places. */
rf = ERFA_DNINT(f*denom) / denom;
/* Re-align to noon. */
djd += 0.5;
/* Convert to Gregorian calendar. */
js = eraJd2cal(djd, rf, &iymdf[0], &iymdf[1], &iymdf[2], &f);
if (js == 0) {
iymdf[3] = (int) ERFA_DNINT(f * denom);
} else {
j = js;
}
/* Return the status. */
return j;
erfasrc/src/taiutc.c view on Meta::CPAN
**
** 2) JD cannot unambiguously represent UTC during a leap second unless
** special measures are taken. The convention in the present
** function is that the JD day represents UTC days whether the
** length is 86399, 86400 or 86401 SI seconds. In the 1960-1972 era
** there were smaller jumps (in either direction) each time the
** linear UTC(TAI) expression was changed, and these "mini-leaps"
** are also included in the ERFA convention.
**
** 3) The function eraD2dtf can be used to transform the UTC quasi-JD
** into calendar date and clock time, including UTC leap second
** handling.
**
** 4) The warning status "dubious year" flags UTCs that predate the
** introduction of the time scale or that are too far in the future
** to be trusted. See eraDat for further details.
**
** Called:
** eraUtctai UTC to TAI
**
** References:
erfasrc/src/ut1utc.c view on Meta::CPAN
** value changes abruptly by 1s at a leap second; however, close to
** a leap second the algorithm used here is tolerant of the "wrong"
** choice of value being made.
**
** 3) JD cannot unambiguously represent UTC during a leap second unless
** special measures are taken. The convention in the present
** function is that the returned quasi JD day UTC1+UTC2 represents
** UTC days whether the length is 86399, 86400 or 86401 SI seconds.
**
** 4) The function eraD2dtf can be used to transform the UTC quasi-JD
** into calendar date and clock time, including UTC leap second
** handling.
**
** 5) The warning status "dubious year" flags UTCs that predate the
** introduction of the time scale or that are too far in the future
** to be trusted. See eraDat for further details.
**
** Called:
** eraJd2cal JD to Gregorian calendar
** eraDat delta(AT) = TAI-UTC
** eraCal2jd Gregorian calendar to JD
**
** References:
**
** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
** IERS Technical Note No. 32, BKG (2004)
**
** Explanatory Supplement to the Astronomical Almanac,
** P. Kenneth Seidelmann (ed), University Science Books (1992)
**
** Copyright (C) 2013-2020, NumFOCUS Foundation.
erfasrc/src/utctai.c view on Meta::CPAN
** function is that the JD day represents UTC days whether the
** length is 86399, 86400 or 86401 SI seconds. In the 1960-1972 era
** there were smaller jumps (in either direction) each time the
** linear UTC(TAI) expression was changed, and these "mini-leaps"
** are also included in the ERFA convention.
**
** 3) The warning status "dubious year" flags UTCs that predate the
** introduction of the time scale or that are too far in the future
** to be trusted. See eraDat for further details.
**
** 4) The function eraDtf2d converts from calendar date and time of day
** into 2-part Julian Date, and in the case of UTC implements the
** leap-second-ambiguity convention described above.
**
** 5) The returned TAI1,TAI2 are such that their sum is the TAI Julian
** Date.
**
** Called:
** eraJd2cal JD to Gregorian calendar
** eraDat delta(AT) = TAI-UTC
** eraCal2jd Gregorian calendar to JD
**
** References:
**
** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
** IERS Technical Note No. 32, BKG (2004)
**
** Explanatory Supplement to the Astronomical Almanac,
** P. Kenneth Seidelmann (ed), University Science Books (1992)
**
** Copyright (C) 2013-2020, NumFOCUS Foundation.
erfasrc/src/utctai.c view on Meta::CPAN
/* Separate TAI-UTC change into per-day (DLOD) and any jump (DLEAP). */
dlod = 2.0 * (dat12 - dat0);
dleap = dat24 - (dat0 + dlod);
/* Remove any scaling applied to spread leap into preceding day. */
fd *= (ERFA_DAYSEC+dleap)/ERFA_DAYSEC;
/* Scale from (pre-1972) UTC seconds to SI seconds. */
fd *= (ERFA_DAYSEC+dlod)/ERFA_DAYSEC;
/* Today's calendar date to 2-part JD. */
if ( eraCal2jd(iy, im, id, &z1, &z2) ) return -1;
/* Assemble the TAI result, preserving the UTC split and order. */
a2 = z1 - u1;
a2 += z2;
a2 += fd + dat0/ERFA_DAYSEC;
if ( big1 ) {
*tai1 = u1;
*tai2 = a2;
} else {
erfasrc/src/utcut1.c view on Meta::CPAN
**
** 2) JD cannot unambiguously represent UTC during a leap second unless
** special measures are taken. The convention in the present
** function is that the JD day represents UTC days whether the
** length is 86399, 86400 or 86401 SI seconds.
**
** 3) The warning status "dubious year" flags UTCs that predate the
** introduction of the time scale or that are too far in the future
** to be trusted. See eraDat for further details.
**
** 4) The function eraDtf2d converts from calendar date and time of
** day into 2-part Julian Date, and in the case of UTC implements
** the leap-second-ambiguity convention described above.
**
** 5) Delta UT1 can be obtained from tabulations provided by the
** International Earth Rotation and Reference Systems Service.
** It is the caller's responsibility to supply a dut1 argument
** containing the UT1-UTC value that matches the given UTC.
**
** 6) The returned ut11,ut12 are such that their sum is the UT1 Julian
** Date.
**
** References:
**
** McCarthy, D. D., Petit, G. (eds.), IERS Conventions (2003),
** IERS Technical Note No. 32, BKG (2004)
**
** Explanatory Supplement to the Astronomical Almanac,
** P. Kenneth Seidelmann (ed), University Science Books (1992)
**
** Called:
** eraJd2cal JD to Gregorian calendar
** eraDat delta(AT) = TAI-UTC
** eraUtctai UTC to TAI
** eraTaiut1 TAI to UT1
**
** Copyright (C) 2013-2020, NumFOCUS Foundation.
** Derived, with permission, from the SOFA library. See notes at end of file.
*/
{
int iy, im, id, js, jw;
double w, dat, dta, tai1, tai2;
palsrc/palCaldj.c view on Meta::CPAN
* Starlink ANSI C
* Type of Module:
* Library routine
* Invocation:
* void palCaldj ( int iy, int im, int id, double *djm, int *j );
* Arguments:
* iy = int (Given)
* Year in the Gregorian calendar
* im = int (Given)
* Month in the Gergorian calendar
* id = int (Given)
* Day in the Gregorian calendar
* djm = double * (Returned)
* Modified Julian Date (JD-2400000.5) for 0 hrs
* j = status (Returned)
* 0 = OK. See eraCal2jd for other values.
* Description:
* Modified Julian Date to Gregorian Calendar with special
* behaviour for 2-digit years relating to 1950 to 2049.
* Authors:
palsrc/palDat.c view on Meta::CPAN
* Description:
* Increment to be applied to Coordinated Universal Time UTC to give
* International Atomic Time (TAI).
* Authors:
* TIMJ: Tim Jenness (JAC, Hawaii)
* {enter_new_authors_here}
* Notes:
* - This routine converts the MJD argument to calendar date before calling
* the SOFA/ERFA eraDat function.
* - This routine matches the slaDat interface which differs from the eraDat
* interface. Consider coding directly to the SOFA/ERFA interface.
* - See eraDat for a description of error conditions when calling this function
* with a time outside of the UTC range.
* - The status argument from eraDat is ignored. This is reasonable since the
* error codes are mainly related to incorrect calendar dates when calculating
* the JD internally.
* History:
* 2012-02-08 (TIMJ):
* Initial version
* Adapted with permission from the Fortran SLALIB library
* although the core algorithm is now from SOFA.
* {enter_further_changes_here}
* Copyright:
palsrc/palDjcal.c view on Meta::CPAN
* Invocation:
* void palDjcal ( int ndp, double djm, int iymdf[4], int *j );
* Arguments:
* ndp = int (Given)
* Number of decimal places of days in fraction.
* djm = double (Given)
* Modified Julian Date (JD-2400000.5)
* iymdf[4] = int[] (Returned)
* Year, month, day, fraction in Gregorian calendar.
* j = status (Returned)
* 0 = OK. See eraJd2cal for other values.
* Description:
* Modified Julian Date to Gregorian Calendar, expressed
* in a form convenient for formatting messages (namely
* rounded to a specified precision, and with the fields
* stored in a single array)
* Authors:
palsrc/palOne2One.c view on Meta::CPAN
* Starlink ANSI C
* Type of Module:
* Library routine
* Invocation:
* palCldj( int iy, int im, int id, double *djm, int *j );
* Arguments:
* iy = int (Given)
* Year in Gregorian calendar
* im = int (Given)
* Month in Gregorian calendar
* id = int (Given)
* Day in Gregorian calendar
* djm = double * (Returned)
* Modified Julian Date (JD-2400000.5) for 0 hrs
* j = int * (Returned)
* status: 0 = OK, 1 = bad year (MJD not computed),
* 2 = bad month (MJD not computed), 3 = bad day (MJD computed).
* Description:
* Gregorian calendar to Modified Julian Date.
* Notes:
* - Uses eraCal2jd(). See SOFA/ERFA documentation for details.
*-
*/
void palCldj ( int iy, int im, int id, double *djm, int *j ) {
double djm0;
*j = eraCal2jd( iy, im, id, &djm0, djm );