2
Copyright (C) 2000 Liam Girdwood <liam@nova-ioe.org>
3
Copyright (C) 2003 Fabien Ch�reau
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU Library General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
30
# define J2000 2451545.0
33
// General Calendar Functions
35
// Human readable (easy printf) date format
38
int years; /*!< Years. All values are valid */
39
int months; /*!< Months. Valid values : 1 (January) - 12 (December) */
40
int days; /*!< Days. Valid values 1 - 28,29,30,31 Depends on month.*/
41
int hours; /*!< Hours. Valid values 0 - 23. */
42
int minutes; /*!< Minutes. Valid values 0 - 59. */
43
double seconds; /*!< Seconds. Valid values 0 - 59.99999.... */
47
/* Calculate the julian day from date.*/
48
double get_julian_day(const ln_date * date);
50
/* Calculate the date from the julian day. */
51
void get_date(double JD, ln_date * date);
53
/* Calculate day of the week. 0 = Sunday .. 6 = Saturday */
54
unsigned int get_day_of_week (const ln_date *date);
56
/* Calculate julian day from system time. */
57
double get_julian_from_sys();
59
/* Calculate gmt date from system date */
60
void get_ln_date_from_sys(ln_date * date);
62
// Obtains a ln_date from 2 strings s1 and s2 for date and time
63
// with the form dd/mm/yyyy for s1 and hh:mm:ss.s for s2.
64
// Returns NULL if s1 or s2 is not valid.
65
// Uses the current date if s1 is "today" and current time if s2 is "now"
66
const ln_date * str_to_date(const char * s1, const char * s2);
68
// Calculate tm struct from julian day
69
void get_tm_from_julian(double JD, struct tm * tm_time);
71
// Calculate time_t from julian day
72
time_t get_time_t_from_julian(double JD);
74
// Return the number of hours to add to gmt time to get the local time
75
// taking the parameters from system. This takes into account the daylight saving
77
int get_gmt_shift_from_system(void);
79
/* puts a large angle in the correct range 0 - 360 degrees */
80
double range_degrees (double angle);
82
/* puts a large angle in the correct range 0 - 2PI radians */
83
double range_radians (double angle);
86
/* Calculate mean sidereal time from date. */
87
double get_mean_sidereal_time (double JD);
89
/* Calculate apparent sidereal time from date.*/
90
double get_apparent_sidereal_time (double JD);
92
/* Input t is time in julian days.
93
* Valid range is the years -8000 to +12000 (t = -100 to 100).
94
* return mean obliquity (epsilon sub 0) in degrees.*/
95
double get_mean_obliquity( double t );
97
/* Calculate Earth globe centre distance. */
98
void get_earth_centre_dist (float height, double latitude, double * p_sin_o, double * p_cos_o);
101
/* Calculate the adjustment in altitude of a body due to atmospheric refraction. */
102
double get_refraction_adj (double altitude, double atm_pres, double temp);
110
#endif /* _STELLASTRO_H */