1 /*
2  *  This library is free software; you can redistribute it and/or
3  *  modify it under the terms of the GNU Lesser General Public
4  *  License as published by the Free Software Foundation; either
5  *  version 2 of the License, or (at your option) any later version.
6  *
7  *  This library is distributed in the hope that it will be useful,
8  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
10  *  Lesser General Public License for more details.
11  *
12  *  You should have received a copy of the GNU General Public License
13  *  along with this program; if not, write to the Free Software
14  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15  *
16  *  Copyright (C) 2000 - 2005 Liam Girdwood
17  */
18 
19 #ifndef _LN_JULIAN_DAY_H
20 #define _LN_JULIAN_DAY_H
21 
22 #ifdef __WIN32
23 #define __WIN32__
24 #endif
25 
26 #include <time.h>
27 #include <libnova/ln_types.h>
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /*! \defgroup calendar General Calendar Functions
34 */
35 
36 /*! \fn double ln_get_julian_day (struct ln_date * date)
37 * \ingroup calendar
38 * \brief Calculate the julian day from date.
39 */
40 double LIBNOVA_EXPORT ln_get_julian_day (struct ln_date * date);
41 
42 /*! \fn void ln_get_date (double JD, struct ln_date * date)
43 * \ingroup calendar
44 * \brief Calculate the date from the julian day.
45 */
46 void LIBNOVA_EXPORT ln_get_date (double JD, struct ln_date * date);
47 
48 /*! \fn void ln_get_date_from_timet (time_t * t, struct ln_date * date)
49 * \\ingroup calendar
50 * \brief Set date from system time
51 */
52 void LIBNOVA_EXPORT ln_get_date_from_timet (time_t * t, struct ln_date * date);
53 
54 /*! \fn void ln_get_date_from_tm (struct tm * t, struct ln_date * date)
55 * \\ingroup calendar
56 * \brief Set date from system tm structure
57 */
58 void LIBNOVA_EXPORT ln_get_date_from_tm (struct tm * t, struct ln_date * date);
59 
60 /*! \fn void ln_get_local_date (double JD, struct ln_zonedate * zonedate)
61 * \ingroup calender
62 * \brief Calculate the zone date from the Julian day
63 */
64 void LIBNOVA_EXPORT ln_get_local_date (double JD, struct ln_zonedate * zonedate);
65 
66 /*! \fn unsigned int ln_get_day_of_week (struct ln_date * date)
67 * \ingroup calendar
68 * \brief Calculate day of the week.
69 */
70 unsigned int LIBNOVA_EXPORT ln_get_day_of_week (struct ln_date *date);
71 
72 /*! \fn double ln_get_julian_from_sys ()
73 * \brief Calculate julian day from system time.
74 * \ingroup calendar
75 */
76 double LIBNOVA_EXPORT ln_get_julian_from_sys ();
77 
78 
79 /*! \fn void ln_get_date_from_sys (struct ln_date * date)
80 * \brief Calculate date from system date
81 * \ingroup calendar
82 */
83 void LIBNOVA_EXPORT ln_get_date_from_sys (struct ln_date * date);
84 
85 /*! \fn double ln_get_julian_from_timet (time_t * time)
86 * \brief Calculate julian day from time_t
87 * \ingroup calendar
88 */
89 double LIBNOVA_EXPORT ln_get_julian_from_timet (time_t * in_time);
90 
91 /*! \fn void ln_get_timet_from_julian (double JD, time_t * in_time)
92 * \brief Calculate time_t from julian day
93 * \ingroup calendar
94 */
95 void LIBNOVA_EXPORT ln_get_timet_from_julian (double JD, time_t * in_time);
96 
97 /*! \fn double ln_get_julian_local_date(struct ln_zonedate* zonedate)
98 * \brief Calculate Julian day from local date
99 * \ingroup calendar
100 */
101 double LIBNOVA_EXPORT ln_get_julian_local_date(struct ln_zonedate* zonedate);
102 
103 /*! \fn int ln_get_date_from_mpc (struct ln_date* date, char* mpc_date)
104 * \brief Calculate the local date from the a MPC packed date.
105 * \ingroup calendar
106 */
107 int LIBNOVA_EXPORT ln_get_date_from_mpc (struct ln_date* date, char* mpc_date);
108 
109 /*! \fn double ln_get_julian_from_mpc (char* mpc_date)
110 * \brief Calculate the julian day from the a MPC packed date.
111 * \ingroup calendar
112 */
113 double LIBNOVA_EXPORT ln_get_julian_from_mpc (char* mpc_date);
114 
115 /*! \fn void ln_date_to_zonedate (struct ln_date * date, struct ln_zonedate * zonedate, long gmtoff)
116 * \brief convert ln_date to ln_zonedate, zero zone info
117 * \ingroup conversion
118 */
119 void LIBNOVA_EXPORT ln_date_to_zonedate (struct ln_date * date, struct ln_zonedate * zonedate, long gmtoff);
120 
121 /*! \fn void ln_zonedate_to_date (struct ln_zonedate * zonedate, struct ln_date * date)
122 * \brief convert ln_zonedate to ln_date
123 * \ingroup conversion
124 */
125 void LIBNOVA_EXPORT ln_zonedate_to_date (struct ln_zonedate * zonedate, struct ln_date * date);
126 
127 #ifdef __cplusplus
128 };
129 #endif
130 
131 #endif
132