1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! Geodate
//!
//! Geodate computes geocentric expressions of points in time using
//! a natural lunisolar calendar with metric time based on decimal fractions
//! of the mean solar day.
//!
//! # Examples
//!
//! ```rust
//! use geodate::geodate;
//!
//! let timestamp = 1403322675;
//! let longitude = -1.826189;
//!
//! assert_eq!("01:14:05:24:15:42", geodate::get_date(timestamp, longitude));
//! ```
//!
//! This library also exposes some useful functions implementing algorithms
//! from the reference book Astronomical Algorithms by Jean Meeus to calculate
//! the precise time of any sunrise, solstice, and new moon required to create
//! a lunisolar calendar.
//!
//! ```rust
//! use geodate::earth_orbit;
//! use geodate::sun_transit;
//!
//! let timestamp = 1403322675;
//! let longitude = -1.826189;
//! let latitude  = 51.178844;
//!
//! let solstice = earth_orbit::get_previous_december_solstice(timestamp);
//! assert_eq!(1387645873, solstice);
//!
//! if let Some(sunrise) = sun_transit::get_sunrise(timestamp, longitude, latitude) {
//!     assert_eq!(1403322705, sunrise);
//! }
//! ```
//!
//! Note: some functions available in pair, for example `get_*_december_solstice()`
//! return the `previous` and `next` events for the given time, while others,
//! like `get_sunrise()`, give the event associated with the current implicit
//! time period (day, month).

extern crate lazy_static;

#[macro_use]
mod utils;

mod julian;
mod math;

pub mod delta_time;

/// Computes solstices and equinoxes times
pub mod earth_orbit;

/// Constructs string representations of the time in a geodate format
pub mod geodate;

/// Computes phases of the Moon and lunation numbers
pub mod moon_phase;

/// Computes moonrise and moonset times
pub mod moon_transit;

/// Computes sunrise, sunset, midnight, and midday times
pub mod sun_transit;