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
59macro_rules! byte_arrays {
61 ( $( $s:literal ),+ $(,)? ) => {
62 [ $( $s.as_bytes() ),+ ]
63 };
64}
65
66#[cfg(feature = "parse")]
70mod alloc_parse;
71
72#[cfg(feature = "wire")]
73mod wire;
74
75mod an_err;
79mod drift;
80mod dt;
81mod light_time;
82mod lite_str;
83mod locale;
84mod position;
85mod scale;
86mod strtime;
87mod time_parts;
88mod time_range;
89mod ymdhms;
90
91pub mod constants;
95pub mod error;
96pub mod historical_utc;
97pub mod leap_seconds;
98pub mod math;
99pub mod tz;
100
101#[cfg(feature = "eop")]
105pub mod eop;
106
107#[cfg(feature = "sidereal")]
108pub mod sidereal;
109
110#[cfg(feature = "parse")]
114pub(crate) use alloc_parse::{
115 alloc_constants::*, date::*, date_classification::*, duration::*, helpers::*, parse_date::*,
116 types::*,
117};
118#[cfg(feature = "parse")]
119pub(crate) use locale::{lang_data::*, lang_map::*};
120
121pub(crate) use constants::*;
125pub(crate) use locale::*;
126#[allow(unused_imports)]
127pub(crate) use math::{
128 atan2::atan2,
129 cos::cos,
130 div::rem_euclid_f,
131 floor::floor_f,
132 log::log,
133 sin::sin,
134 sqrt::{hypot, sqrt},
135};
136pub(crate) use strtime::*;
137
138#[cfg(feature = "parse")]
142pub use alloc_parse::types::{Mode, Order, ParseCfg};
143
144#[cfg(feature = "wire")]
145pub use an_err::{WireErr, WireLocation};
146
147#[cfg(feature = "sidereal")]
148pub use sidereal::Sidereal;
149
150#[cfg(feature = "mars")]
151pub use dt::mars;
152
153pub use an_err::AnErr;
157pub use drift::{Drift, Spacetime};
158pub use dt::numbers_traits::{AttosTraits, TimeTraits};
159pub use dt::{Dt, lunar};
160pub use error::{DtErr, DtErrKind};
161pub use light_time::ObserverState;
162pub use lite_str::LiteStr;
163pub use locale::Lang;
164pub use position::{Position, Velocity};
165pub use scale::Scale;
166pub use strtime::StrPTimeFmt;
167pub use time_parts::{Meridiem, Offset, TimeParts, Weekday};
168pub use time_range::{Every, TimeRange};
169pub use ymdhms::YmdHms;