diff options
Diffstat (limited to 'src/libical/astime.h')
-rw-r--r-- | src/libical/astime.h | 78 |
1 files changed, 74 insertions, 4 deletions
diff --git a/src/libical/astime.h b/src/libical/astime.h index 38b12c4f..f89ddf67 100644 --- a/src/libical/astime.h +++ b/src/libical/astime.h @@ -1,4 +1,8 @@ /* + * This work is based on work from Hiram Clawson and has been modified to the + * needs of the libical project. The original copyright notice is as follows: + */ +/* * Copyright (c) 1986-2000, Hiram Clawson * All rights reserved. * @@ -33,6 +37,18 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. */ +/* + * The modifications made are licensed as follows (to distinguish between + * the original code and the modifications made, refer to the source code + * history): + */ + /*====================================================================== + + SPDX-FileCopyrightText: 2018, Markus Minichmayr + https://tapkey.com + + SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0 + ========================================================================*/ /** * @file astime.h @@ -42,6 +58,7 @@ #ifndef ICAL_ASTIME_H #define ICAL_ASTIME_H +#include "libical_deprecated.h" #include "libical_ical_export.h" typedef struct ut_instant @@ -62,10 +79,63 @@ typedef struct ut_instant /* Functions in caldate.c */ -/** @brief Converts Julian date to year,mo,da. */ -LIBICAL_ICAL_EXPORT long caldat(UTinstantPtr); +/** Converts julian date to year,mo,da + * @deprecated use caldat_int() instead + */ +LIBICAL_ICAL_EXPORT LIBICAL_DEPRECATED(long caldat(UTinstantPtr)); + +/** Returns julian day from year,mo,da + * @deprecated use juldat_int() instead + */ +LIBICAL_ICAL_EXPORT LIBICAL_DEPRECATED(double juldat(UTinstantPtr)); + +typedef struct ut_instant_int +{ + long j_date0; /**< julian decimal date, 0 = 01 Jan 4713 BC */ + long year; /**< year, valid range [-4,713, +32,767] */ + int month; /**< [1-12] */ + int day; /**< [1-31] */ + int weekday; /**< [0-6] */ + int day_of_year; /**< [1-366] */ +} UTinstantInt, *UTinstantIntPtr; + +/* Functions in caldate.c */ + +/** + * caldat computes the day of the week, the day of the year + * the gregorian (or julian) calendar date + * from the julian decimal date. + * for astronomical purposes, The Gregorian calendar reform occurred + * on 15 Oct. 1582. This is 05 Oct 1582 by the julian calendar. + + * Input: a ut_instant structure pointer, where the j_date element + * has been set. ( = 0 for 01 Jan 4713 B.C.) + * + * output: will set all the other elements of the structure. + * As a convenience, the function will also return the year. + * + * Reference: Astronomial formulae for calculators, meeus, p 23 + * from fortran program by F. Espenak - April 1982 Page 277, + * 50 Year canon of solar eclipses: 1986-2035 + * + */ +void caldat_int(UTinstantIntPtr); -/** @brief Returns Julian day from year,mo,da. */ -LIBICAL_ICAL_EXPORT double juldat(UTinstantPtr); +/** + * juldat computes the julian decimal date (j_date) from + * the gregorian (or Julian) calendar date. + * for astronomical purposes, The Gregorian calendar reform occurred + * on 15 Oct. 1582. This is 05 Oct 1582 by the julian calendar. + * Input: a ut_instant structure pointer where Day, Month, Year + * have been set for the date in question. + * + * Output: the j_date and weekday elements of the structure will be set. + * Also, the return value of the function will be the j_date too. + * + * Reference: Astronomial formulae for calculators, meeus, p 23 + * from fortran program by F. Espenak - April 1982 Page 276, + * 50 Year canon of solar eclipses: 1986-2035 + */ +void juldat_int(UTinstantIntPtr); #endif |