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
68
69
70
71
//! Geodate
//!
//! Geodate computes a representation of the current local time in a geocentric
//! date format using a more natural lunisolar calendar with metric time.
//!
//! # Examples
//!
//! ```rust
//! use geodate::geodate;
//!
//! let timestamp = 1403322675;
//! let longitude = -1.826189;
//!
//! println!("{}", geodate::get_lunisolar_date(timestamp, longitude));
//! // 44:05:24:15:42
//! ```
//!
//! 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);
//! println!("timestamp of previous december solstice: {}", solstice);
//!
//! if let Some(sunrise) = sun_transit::get_sunrise(timestamp, longitude, latitude) {
//!     println!("timestamp of sunrise: {}", sunrise);
//! }
//! ```
//!
//! Note: some functions available in pair, like `get_*_december_solstice()`
//! returns 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).

#[macro_use]
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;