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 dt;
79mod lite_str;
80mod locale;
81mod physics;
82mod scale;
83mod strtime;
84mod time_range;
85mod ymdhms;
86
87pub mod an_err;
91pub mod civil_parts;
92pub mod constants;
93pub mod error;
94pub mod historical_utc;
95pub mod leap_seconds;
96pub mod math;
97pub mod tz;
98
99#[cfg(feature = "eop")]
103pub mod eop;
104
105#[cfg(feature = "sidereal")]
106pub mod sidereal;
107
108#[cfg(feature = "parse")]
112pub(crate) use alloc_parse::{
113 alloc_constants::*, date::*, date_classification::*, duration::*, helpers::*, parse_date::*,
114 types::*,
115};
116#[cfg(feature = "parse")]
117pub(crate) use locale::{lang_data::*, lang_map::*};
118
119pub(crate) use civil_parts::*;
123pub(crate) use constants::*;
124pub(crate) use locale::*;
125#[allow(unused_imports)]
126pub(crate) use math::{
127 atan2::atan2,
128 cos::cos,
129 div::rem_euclid_f,
130 floor::floor_f,
131 log::log,
132 sin::sin,
133 sqrt::{hypot, sqrt},
134};
135pub(crate) use strtime::*;
136
137#[cfg(feature = "parse")]
141pub use alloc_parse::types::{Mode, Order, ParseCfg};
142
143#[cfg(feature = "mars")]
144pub use dt::mars;
145
146#[cfg(feature = "sidereal")]
147pub use sidereal::Sidereal;
148
149pub use an_err::AnErr;
153pub use dt::Dt;
154pub use dt::lunar;
155pub use dt::numbers_traits::{AttosTraits, TimeTraits};
156pub use error::{DtErr, DtErrKind};
157pub use lite_str::LiteStr;
158pub use locale::Lang;
159pub use physics::drift::{Drift, Spacetime};
160pub use physics::light_time::Observer;
161pub use physics::position::{Position, Velocity};
162pub use scale::Scale;
163pub use strtime::StrPTimeFmt;
164pub use time_range::{Every, TimeRange};
165pub use ymdhms::YmdHms;