1#![cfg_attr(not(feature = "std"), no_std)]
2
3#[cfg(feature = "alloc")]
4extern crate alloc;
5#[cfg(feature = "std")]
6extern crate std;
7
8#[cfg(all(feature = "panic-handler", not(feature = "std"), not(test)))]
12use core::panic::PanicInfo;
13
14#[cfg(all(feature = "panic-handler", not(feature = "std"), not(test)))]
15#[panic_handler]
16fn panic(_info: &PanicInfo) -> ! {
17 loop {
19 core::hint::spin_loop();
20 }
21}
22
23pub type Real = f64;
25macro_rules! f {
26 ($x:expr) => {
27 $x as Real
28 };
29}
30
31#[inline(always)]
32pub const fn to_sec_f(attos: u128) -> Real {
33 f!(attos) / ATTOS_PER_SECF
34}
35
36#[inline(always)]
38pub fn to_sec(attos: i128) -> i128 {
39 attos / ATTOS_PER_SEC_I128
40}
41
42#[inline(always)]
44pub fn to_ms(attos: i128) -> i128 {
45 attos / ATTOS_PER_MS_I128
46}
47
48#[inline(always)]
50pub fn to_us(attos: i128) -> i128 {
51 attos / ATTOS_PER_US_I128
52}
53
54#[inline(always)]
56pub fn to_ns(attos: i128) -> i128 {
57 attos / ATTOS_PER_NS_I128
58}
59
60#[inline(always)]
62pub fn to_ps(attos: i128) -> i128 {
63 attos / ATTOS_PER_PS_I128
64}
65
66#[inline(always)]
68pub fn to_fs(attos: i128) -> i128 {
69 attos / ATTOS_PER_FS_I128
70}
71
72#[cfg(feature = "parse")]
76mod alloc_parse;
77
78#[cfg(feature = "ut1")]
79mod ut1;
80
81mod an_err;
85mod ascii_str;
86mod clock_drift;
87mod clock_model;
88mod dt;
89mod gregorian_time;
90mod light_time;
91mod parser;
92mod position;
93mod scale;
94mod t_span;
95mod time_parts;
96mod time_range;
97
98pub mod constants;
102pub mod error;
103pub mod historical_sofa;
104pub mod leap_seconds;
105pub mod tzdb;
106pub mod utils;
107
108#[cfg(feature = "parse")]
112pub(crate) use alloc_parse::{
113 alloc_constants::*, date::*, date_classification::*, duration::*, lang_data::*, lang_map::*,
114 languages::en::*, parse_date::*, types::*,
115};
116
117pub(crate) use constants::*;
121pub(crate) use utils::*;
122
123#[cfg(feature = "parse")]
127pub use alloc_parse::types::{DateOrder, DateParseMode, Lang, ParseCfg};
128
129#[cfg(feature = "ut1")]
130pub use ut1::{Separator, Ut1Columns, Ut1Data, Ut1Format, Ut1Row};
131
132#[cfg(feature = "wire")]
133pub use an_err::{WireErr, WireLocation};
134
135pub use an_err::AnErr;
139pub use ascii_str::{AsciiStr, AsciiStrError};
140pub use clock_drift::{ClockDrift, LocalSpacetime};
141pub use clock_model::ClockModel;
142pub use dt::Dt;
143pub use error::{DtErr, DtErrKind};
144pub use gregorian_time::GregorianTime;
145pub use light_time::{LightContext, ObserverState};
146pub use position::{Position, Velocity};
147pub use scale::Scale;
148pub use t_span::TSpan;
149pub use t_span::time_units::{AttosUnits, TimeUnits};
150pub use time_parts::{Meridiem, Offset, TimeParts, Weekday};
151pub use time_range::{Every, TimeRange};