1#![cfg_attr(test, allow(clippy::all))]
2#![cfg_attr(not(feature = "std"), no_std)]
3
4#[cfg(feature = "alloc")]
5extern crate alloc;
6#[cfg(feature = "std")]
7extern crate std;
8
9#[cfg(all(feature = "panic-handler", not(feature = "std"), not(test)))]
13use core::panic::PanicInfo;
14
15#[cfg(all(feature = "panic-handler", not(feature = "std"), not(test)))]
16#[panic_handler]
17fn panic(_info: &PanicInfo) -> ! {
18 loop {
20 core::hint::spin_loop();
21 }
22}
23
24pub type Real = f64;
26
27#[macro_export]
31macro_rules! f {
32 ($x:expr) => {
33 $x as $crate::Real
34 };
35}
36
37macro_rules! safe_div_euc {
40 ($lhs:expr, $rhs:expr, $default:expr) => {{
41 match ($lhs).checked_div_euclid($rhs) {
42 Some(q) => q,
43 None => $default,
44 }
45 }};
46}
47
48macro_rules! safe_rem_euc {
51 ($lhs:expr, $rhs:expr, $default:expr) => {{
52 match ($lhs).checked_rem_euclid($rhs) {
53 Some(r) => r,
54 None => $default,
55 }
56 }};
57}
58
59#[cfg(feature = "parse")]
63mod alloc_parse;
64
65#[cfg(feature = "wire")]
66mod wire;
67
68mod an_err;
72mod drift;
73mod dt;
74mod light_time;
75mod lite_str;
76mod parser;
77mod position;
78mod scale;
79mod time_parts;
80mod time_range;
81mod ymdhms;
82
83pub mod constants;
87pub mod error;
88pub mod historical_sofa;
89pub mod leap_seconds;
90pub mod math;
91pub mod tzdb;
92
93#[cfg(feature = "eop")]
97pub mod eop;
98
99#[cfg(feature = "sidereal")]
100pub mod sidereal;
101
102#[cfg(feature = "parse")]
106pub(crate) use alloc_parse::{
107 alloc_constants::*, date::*, date_classification::*, duration::*, lang_data::*, lang_map::*,
108 languages::en::*, parse_date::*, types::*,
109};
110
111pub(crate) use constants::*;
115#[allow(unused_imports)]
116pub(crate) use math::{
117 atan2::atan2,
118 cos::cos,
119 div::rem_euclid_f,
120 floor::floor_f,
121 log::log,
122 sin::sin,
123 sqrt::{hypot, sqrt},
124};
125
126#[cfg(feature = "parse")]
130pub use alloc_parse::types::{Lang, Mode, Order, ParseCfg};
131
132#[cfg(feature = "wire")]
133pub use an_err::{WireErr, WireLocation};
134
135#[cfg(feature = "sidereal")]
136pub use sidereal::Sidereal;
137
138#[cfg(feature = "mars")]
139pub use dt::mars;
140
141pub use an_err::AnErr;
145pub use drift::{Drift, Spacetime};
146pub use dt::numbers_traits::{AttosTraits, TimeTraits};
147pub use dt::{Dt, lunar};
148pub use error::{DtErr, DtErrKind};
149pub use light_time::ObserverState;
150pub use lite_str::{LiteStr, LiteStrErr};
151pub use parser::StrPTimeFmt;
152pub use position::{Position, Velocity};
153pub use scale::Scale;
154pub use time_parts::{Meridiem, Offset, TimeParts, Weekday};
155pub use time_range::{Every, TimeRange};
156pub use ymdhms::{YmdHms, YmdHmsRich};