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#[cfg(feature = "physics")]
72mod physics;
73
74mod dt;
78mod lite_str;
79mod locale;
80mod scale;
81mod strtime;
82mod time_range;
83mod ymdhms;
84
85pub mod an_err;
89pub mod civil_parts;
90pub mod constants;
91pub mod error;
92pub mod historical_utc;
93pub mod leap_seconds;
94pub mod math;
95pub mod tz;
96
97#[cfg(feature = "eop")]
101pub mod eop;
102
103#[cfg(feature = "sidereal")]
104pub mod sidereal;
105
106#[cfg(feature = "parse")]
110pub(crate) use alloc_parse::{
111 alloc_constants::*, date::*, date_classification::*, duration::*, helpers::*, parse_date::*,
112 types::*,
113};
114#[cfg(feature = "parse")]
115pub(crate) use locale::{lang_data::*, lang_map::*};
116
117pub(crate) use civil_parts::*;
121pub(crate) use constants::*;
122pub(crate) use locale::*;
123#[allow(unused_imports)]
124pub(crate) use math::{
125 atan2::atan2,
126 cos::cos,
127 div::rem_euclid_f,
128 floor::floor_f,
129 log::log,
130 sin::sin,
131 sqrt::{hypot, sqrt},
132};
133pub(crate) use strtime::*;
134
135#[cfg(feature = "tdb_fairhead1990")]
139pub use dt::tdb_fairhead1990;
140
141#[cfg(feature = "parse")]
142pub use alloc_parse::types::{Mode, Order, ParseCfg};
143
144#[cfg(feature = "mars")]
145pub use dt::mars;
146
147#[cfg(feature = "sidereal")]
148pub use sidereal::Sidereal;
149
150#[cfg(feature = "physics")]
151pub use physics::{
152 drift::Drift, observer::Observer, position::Position, spacetime::Spacetime, velocity::Velocity,
153};
154
155pub use an_err::AnErr;
159pub use dt::Dt;
160pub use dt::lunar;
161pub use dt::numbers_traits::{AttosTraits, TimeTraits};
162pub use error::{DtErr, DtErrKind};
163pub use lite_str::LiteStr;
164pub use locale::Lang;
165pub use scale::Scale;
166pub use strtime::StrPTimeFmt;
167pub use time_range::{Every, TimeRange};
168pub use ymdhms::YmdHms;