geodate/
lib.rs

1//! Geodate
2//!
3//! Geodate computes geocentric expressions of points in time using
4//! a natural lunisolar calendar with metric time based on decimal fractions
5//! of the mean solar day.
6//!
7//! # Examples
8//!
9//! ```rust
10//! use geodate::geodate;
11//!
12//! let timestamp = 1403322675;
13//! let longitude = -1.826189;
14//!
15//! assert_eq!("01:14:05:24:15:42", geodate::get_date(timestamp, longitude));
16//! ```
17//!
18//! This library also exposes some useful functions implementing algorithms
19//! from the reference book Astronomical Algorithms by Jean Meeus to calculate
20//! the precise time of any sunrise, solstice, and new moon required to create
21//! a lunisolar calendar.
22//!
23//! ```rust
24//! use geodate::earth_orbit;
25//! use geodate::sun_transit;
26//!
27//! let timestamp = 1403322675;
28//! let longitude = -1.826189;
29//! let latitude  = 51.178844;
30//!
31//! let solstice = earth_orbit::get_previous_december_solstice(timestamp);
32//! assert_eq!(1387645873, solstice);
33//!
34//! if let Some(sunrise) = sun_transit::get_sunrise(timestamp, longitude, latitude) {
35//!     assert_eq!(1403322705, sunrise);
36//! }
37//! ```
38//!
39//! Note: some functions available in pair, for example `get_*_december_solstice()`
40//! return the `previous` and `next` events for the given time, while others,
41//! like `get_sunrise()`, give the event associated with the current implicit
42//! time period (day, month).
43
44#![no_std]
45#[cfg(feature = "std")]
46extern crate std;
47
48#[macro_use]
49extern crate alloc;
50extern crate num_traits;
51
52#[macro_use]
53mod utils;
54
55mod julian;
56mod math;
57
58pub mod delta_time;
59
60/// Computes solstices and equinoxes times
61pub mod earth_orbit;
62
63/// Constructs string representations of the time in a geodate format
64pub mod geodate;
65
66/// Computes phases of the Moon and lunation numbers
67pub mod moon_phase;
68
69/// Computes moonrise and moonset times
70pub mod moon_transit;
71
72/// Computes sunrise, sunset, midnight, and midday times
73pub mod sun_transit;
74
75/// Computes ephemeris
76pub mod ephemeris;
77
78/// Reverse a geodate into a timestamp
79pub mod reverse;